Skip to content

Commit

Permalink
commonio: free removed database entries
Browse files Browse the repository at this point in the history
Free the actual struct of the removed entry.

Example userdel report:

    Direct leak of 40 byte(s) in 1 object(s) allocated from:
        #0 0x55b230efe857 in reallocarray (./src/userdel+0xda857)
        #1 0x55b230f6041f in mallocarray ./lib/./alloc.h:97:9
        #2 0x55b230f6041f in commonio_open ./lib/commonio.c:563:7
        #3 0x55b230f39098 in open_files ./src/userdel.c:555:6
        #4 0x55b230f39098 in main ./src/userdel.c:1189:2
        #5 0x7f9b48c64189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  • Loading branch information
cgzones authored and hallyn committed Apr 26, 2023
1 parent 4e1f674 commit a8dd8ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/commonio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,8 @@ int commonio_remove (struct commonio_db *db, const char *name)
db->ops->free (p->eptr);
}

free(p);

return 1;
}

Expand Down

0 comments on commit a8dd8ce

Please sign in to comment.