Bug#816872: wmbattery: memory leak in wmbattery

Doug Torrance dtorrance at piedmont.edu
Mon Oct 23 12:23:41 UTC 2017


On 10/19/2017 12:43 PM, bw wrote:
>
>
> On Thu, 19 Oct 2017, Tim Connors wrote:
>
>>> Package: wmbattery
>>> Version: 2.50-1+b1
>>> Followup-For: Bug #816872
>>>
>>> Dear Maintainer,
>>>
>>> Memory bug is still present, nice app though overall, thanks.
>>
>> Hi, this just killed my system (13GB RSS, 20GB VMM).
>> Oct 19 22:46:35 dirac kernel: [163443.300793] Killed process 12027
>> (wmbattery) total-vm:20361464kB, anon-rss:12105144kB, file-rss:728kB,
>> shmem-rss:0kB
>>
>> Since there's no activity on this bug since March 2016,
>> could the maintainers please arrange for this to be removed from debian?
>>
>>
>> --
>> Tim Connors
>>
>> _______________________________________________
>> Pkg-wmaker-devel mailing list
>> Pkg-wmaker-devel at lists.alioth.debian.org
>> https://lists.alioth.debian.org/mailman/listinfo/pkg-wmaker-devel
>>
>
> My C is very rusty so I didn't look into this much.  I found package
> wmacpi that does a good job at monitoring the battery and doesn't have the
> same issue.
>
> Looking at the source code for wmbattery, In the file acpi.c there is a
> function called find_items() that allocates memory for a list of devices
> like this:
>
>> char **devices = malloc(ACPI_MAXITEM * sizeof(char *));
>
> This works out to 8 * 8 on amd64 or 64 pointers to contain the list.
> During the while loop later, it looks like all the acpi device filenames
> are read into this array of pointers and assigned memory by the strdup()
> call.
>
> I'm not sure what dir it's looking at, but on my system, there are more
> than 64 acpi devices... so this would seem problematic if the way I
> understand it is correct.
>
> b17 at themini:/sys/bus/acpi/devices$ ls | wc -l
> 70
>
> It's a nice looking app, but yeah if this bug can't be found and fixed I
> agree it should be assigned grave importance.

Thanks for the reminder about this bug and the investigative work!

I'm both the Debian maintainer and primary upstream maintainer.  I'm 
pretty busy at work for the next week or so, but I'll try and take a 
look at it before too long.

Doug



More information about the Pkg-wmaker-devel mailing list