Author: jra Date: 2006-06-28 02:12:45 +0000 (Wed, 28 Jun 2006) New Revision: 16600
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16600 Log: Klocwork #2038. Fix memleak on error path. Jeremy. Modified: trunk/source/rpc_parse/parse_eventlog.c Changeset: Modified: trunk/source/rpc_parse/parse_eventlog.c =================================================================== --- trunk/source/rpc_parse/parse_eventlog.c 2006-06-28 02:02:26 UTC (rev 16599) +++ trunk/source/rpc_parse/parse_eventlog.c 2006-06-28 02:12:45 UTC (rev 16600) @@ -353,19 +353,19 @@ /* Now pad with whitespace until the end of the response buffer */ - r_u->end_of_entries_padding = - SMB_CALLOC_ARRAY(uint8, - q_u->max_read_size - r_u->num_bytes_in_resp); + if (q_u->max_read_size - r_u->num_bytes_in_resp) { + r_u->end_of_entries_padding = SMB_CALLOC_ARRAY(uint8, q_u->max_read_size - r_u->num_bytes_in_resp); - if(!(prs_uint8s(False, "end of entries padding", ps, - depth, r_u->end_of_entries_padding, - (q_u->max_read_size - r_u->num_bytes_in_resp)))) - { - return False; + if(!(prs_uint8s(False, "end of entries padding", ps, + depth, r_u->end_of_entries_padding, + (q_u->max_read_size - r_u->num_bytes_in_resp)))) { + free(r_u->end_of_entries_padding); + return False; + } + + free(r_u->end_of_entries_padding); } - free(r_u->end_of_entries_padding); - /* We had better be DWORD aligned here */ if(!(prs_uint32("sent size", ps, depth, &(r_u->sent_size))))