Author: jra
Date: 2006-06-28 02:12:53 +0000 (Wed, 28 Jun 2006)
New Revision: 16601

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16601

Log:
Klocwork #2038. Fix memleak on error path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_parse/parse_eventlog.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_parse/parse_eventlog.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_parse/parse_eventlog.c        2006-06-28 
02:12:45 UTC (rev 16600)
+++ branches/SAMBA_3_0/source/rpc_parse/parse_eventlog.c        2006-06-28 
02:12:53 UTC (rev 16601)
@@ -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))))

Reply via email to