Author: vlendec
Date: 2006-06-12 08:28:21 +0000 (Mon, 12 Jun 2006)
New Revision: 16148

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

Log:
Fix memleak found by Klocwork, id#3
Modified:
   trunk/source/libsmb/asn1.c


Changeset:
Modified: trunk/source/libsmb/asn1.c
===================================================================
--- trunk/source/libsmb/asn1.c  2006-06-12 04:28:55 UTC (rev 16147)
+++ trunk/source/libsmb/asn1.c  2006-06-12 08:28:21 UTC (rev 16148)
@@ -268,17 +268,22 @@
        }
 
        if (!asn1_read_uint8(data, &b)) {
+               SAFE_FREE(nesting);
                return False;
        }
 
        if (b & 0x80) {
                int n = b & 0x7f;
-               if (!asn1_read_uint8(data, &b))
+               if (!asn1_read_uint8(data, &b)) {
+                       SAFE_FREE(nesting);
                        return False;
+               }
                nesting->taglen = b;
                while (n > 1) {
-                       if (!asn1_read_uint8(data, &b)) 
+                       if (!asn1_read_uint8(data, &b)) {
+                               SAFE_FREE(nesting);
                                return False;
+                       }
                        nesting->taglen = (nesting->taglen << 8) | b;
                        n--;
                }

Reply via email to