[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: BUG + patch: rdev applet doesn't free all memory
From:       Steven Honeyman <stevenhoneyman () gmail ! com>
Date:       2014-10-27 22:54:09
Message-ID: CABz95_Bhn47Uc=TVsXhVUAGsXgNaMc8Ona4YGpci+MbskiOPmg () mail ! gmail ! com
[Download RAW message or body]

On 27 October 2014 20:52, Peter van Vugt <pwvanvugt@gmail.com> wrote:
> package: busybox
> version: 1.23.0.git
>
> The rdev applet fails to free the memory allocated by find_root_device().
...
> Here is a simple patch that fixes the issue. Run rdev as above after
> patching and Valgrind will report no leaks.

busybox isn't usually concerned about freeing resources, unless the
option FEATURE_CLEAN_UP is configured. Here's the text from that:

      As a size optimization, busybox normally exits without explicitly
      freeing dynamically allocated memory or closing files. This saves
      space since the OS will clean up for us, but it can confuse debuggers
      like valgrind, which report tons of memory and resource leaks.

      Don't enable this unless you have a really good reason to clean
      things up manually.

So this sort of thing is in most applets:

if (ENABLE_FEATURE_CLEAN_UP) {
    free(root_device);
}


Steven
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic