Memory leak in sensors_get_label()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jean,

  thanks for looking at this.

khali at linux-fr.org said:
> Thanks a lot for looking into this. We know there are a few leaks in
> libsensors, most of which are in the configuration file parser, and none of
> us know how to fix them.

  Yes, sensors_parse_chip_name() definitely leaks memory too; however as
the file parsing stuff isn't usually called repeatedly, I'm less concerned
about this.

khali at linux-fr.org said:
> We can't blame you for not understanding how that code works. It's not
> exactly elegant, let alone the terrible coding style and lack of comments. 

  Well, I didn't want to say anything...!  In my experience, not using
braces for conditionals and (especially) loops usually leads to bugs, and
hard-to-spot ones at that.

khali at linux-fr.org said:
> Yes of course. Leaks are bad anyway, so let's kill that one. What tool are
> you using BTW? sensord? 

  No, we have a home-brew module that exports sensor information via 
SNMP.

khali at linux-fr.org said:
> I've attached my proposed patch. Please give it a try. If it works for you
> and nobody objects to the way it changes the function, I'll apply it to
> lm_sensors CVS. 

  I've given this a try, and it works without leaks.  It does change the
output -- we have a section like this in sensors.conf:

    label temp1       "CPU"
    set   temp1_over  55
    set   temp1_hyst  53

Previously we would get "temp1_hyst" returned as a label; now we just get 
"temp1_low".  This isn't a problem for us; is it what you would have expected
though?

khali at linux-fr.org said:
> And if you happen to spot other leaks ruining your embedded platforms,
> please let us know, and we'll try to hunt them down. 

  Will do!  Thanks again for your response.

John
-- 
Dr. John Naylon
Cambridge Broadband Ltd. // www.cambridgebroadband.com





[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux