Menu ▾ ▴

#359 memory leak in ipmi_sel_show_entry()

version-cvs
open
None
5
2015-11-17
2015-01-20
No

According to Coverity, there are two memory leaks in ipmi_sel_show_entry().

[...]
/* This isn't marked, but I believe it's leaking memory as well,

 * because it's similar to the later, isn't it?
 */
sdr = ipmi_sdr_find_sdr_bynumtype(intf,
            evt.sel_type.standard_type.gen_id,
            evt.sel_type.standard_type.sensor_num,
            evt.sel_type.standard_type.sensor_type);
[...]
/* This is being over-written constantly and Coverity doesn't like it.
 * Also, malloc() is called in ipmi_sdr_find_sdr_byentity(), but no free().
 */
list = ipmi_sdr_find_sdr_byentity(intf, &entity);

And then there is issue with variable list not being free()-ed. I thought and still believe calling ipmi_sdr_list_empty() should fix memory leak, but it didn't satisfy Coverity. I haven't studied code thoroughly, but if I understand it correctly, only pointers are being returned and items(allocated memory) are kept/referenced in global SDR list. Therefore, ipmi_sdr_list_empty() should cover cleanup.

Any thoughts on this one, Jim?

Discussion

  • Zdenek Styblik

    Zdenek Styblik - 2015-01-20

    And then there is issue with variable list not being free()-ed

    On exit from ipmi_sel_show_entry() that is.

     
  • Zdenek Styblik

    Zdenek Styblik - 2015-11-17
    • Group: version-1.8.16 --> version-cvs
     
  • Zdenek Styblik

    Zdenek Styblik - 2015-11-17

    Jim?

     

Log in to post a comment.