Project

General

Profile

Actions

Bug #10947

closed

loader: memory related issues in module.c

Added by Toomas Soome over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
bootloader
Start date:
2019-05-10
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

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.

Actions #1

Updated by Toomas Soome over 4 years ago

  • Description updated (diff)
Actions #2

Updated by Electric Monk over 4 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 08e3b8cf1f1ed2d597092d1de9fa46c7e2947d98

commit  08e3b8cf1f1ed2d597092d1de9fa46c7e2947d98
Author: Toomas Soome <tsoome@me.com>
Date:   2019-05-16T18:40:46.000Z

    10947 loader: memory related issues in module.c
    Reviewed by: Gergő Doma <domag02@gmail.com>
    Reviewed by: John Levon <john.levon@joyent.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF