]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Free memory on error path 6/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 12 Jul 2015 12:30:32 +0000 (14:30 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 12 Jul 2015 12:30:32 +0000 (14:30 +0200)
When multiple entries with the same name are encountered, nentry is
not properly freed, which results in a memory leak.

lib/commonio.c

index cc536bf140c7a98dd778784ce43baf085f4f05a4..8ff0e07d0766b6c87e674d4fe75fcccb60ffa525 100644 (file)
@@ -1081,6 +1081,7 @@ int commonio_update (struct commonio_db *db, const void *eptr)
        if (NULL != p) {
                if (next_entry_by_name (db, p->next, db->ops->getname (eptr)) != NULL) {
                        fprintf (stderr, _("Multiple entries named '%s' in %s. Please fix this with pwck or grpck.\n"), db->ops->getname (eptr), db->filename);
+                       db->ops->free (nentry);
                        return 0;
                }
                db->ops->free (p->eptr);