loader: memory related issues in module.c
1. file_loadraw() is leaking char *name.
2. file_loadraw() needs to check strdup and unargv.
3. mod_load() does not need if statement for free().
4. file_addmodule() - malloc + bzero is calloc.
5. file_addmodule() needs to check strdup.
6. file_discard() does not need if before free().
7. file_alloc() malloc + bzero is calloc.
8. moduledir_readhints() does not need if before free()
9. moduledir_rebuild() does not need if before free()
No cstyle. this patch is pre-requisite for cstyle patch (it is large).
Testing done: build/install/boot
The main test plan for us is all about using the update itself, no unexpected behavior seen.
But also part of the same change appeared to be already implemented in FreeBSD, I did commit the missing leak fixes there, and therefore the respective changes are tested in FreeBSD as well.
There is a bit of difference between loaders, however. The kernel module loading code is specific for FreeBSD - we do not use it, the font and environment module setup is specific to illumos.
Despite off some differences, since the question is about “if (X == NULL)” type of checks - those are easy to track and verify.
Updated by Electric Monk 5 months ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
commit 08e3b8cf1f1ed2d597092d1de9fa46c7e2947d98 Author: Toomas Soome <email@example.com> Date: 2019-05-16T18:40:46.000Z 10947 loader: memory related issues in module.c Reviewed by: Gergő Doma <firstname.lastname@example.org> Reviewed by: John Levon <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>