ID: 3600928 - 'lib/ipmi_pef.c' memory leaks

Commit fixes memory leaks in 'lib/ipmi_pef.c'.

Reported-by: Ales Ledvinka
This commit is contained in:
Zdenek Styblik 2013-02-13 11:28:58 +00:00
parent a70de993cf
commit c726a09482

View File

@ -667,13 +667,18 @@ ipmi_pef_list_policies(struct ipmi_intf * intf)
*/ */
struct ipmi_rs * rsp; struct ipmi_rs * rsp;
struct ipmi_rq req; struct ipmi_rq req;
struct pef_cfgparm_policy_table_entry * ptbl, * ptmp; struct pef_cfgparm_policy_table_entry * ptbl = NULL;
struct pef_cfgparm_policy_table_entry * ptmp = NULL;
uint32_t i; uint32_t i;
uint8_t wrk, ch, medium, tbl_size; uint8_t wrk, ch, medium, tbl_size;
tbl_size = ipmi_pef_get_policy_table(intf, &ptbl); tbl_size = ipmi_pef_get_policy_table(intf, &ptbl);
if (!tbl_size) if (!tbl_size) {
if (!ptbl) {
free(ptbl);
}
return; return;
}
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_APP; req.msg.netfn = IPMI_NETFN_APP;
req.msg.cmd = IPMI_CMD_GET_CHANNEL_INFO; req.msg.cmd = IPMI_CMD_GET_CHANNEL_INFO;
@ -796,12 +801,14 @@ ipmi_pef_get_info(struct ipmi_intf * intf)
struct ipmi_rq req; struct ipmi_rq req;
struct pef_capabilities * pcap; struct pef_capabilities * pcap;
struct pef_cfgparm_selector psel; struct pef_cfgparm_selector psel;
struct pef_cfgparm_policy_table_entry * ptbl; struct pef_cfgparm_policy_table_entry * ptbl = NULL;
uint8_t * uid; uint8_t * uid;
uint8_t actions, tbl_size; uint8_t actions, tbl_size;
if ((tbl_size = ipmi_pef_get_policy_table(intf, &ptbl)) > 0) tbl_size = ipmi_pef_get_policy_table(intf, &ptbl);
if (!ptbl) {
free(ptbl); free(ptbl);
}
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_SE; req.msg.netfn = IPMI_NETFN_SE;