]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
tls-handshake: Add some missing free in error handling.
authorEric Leblond <eric@regit.org>
Mon, 19 Dec 2011 09:22:06 +0000 (10:22 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 19 Mar 2012 11:12:25 +0000 (12:12 +0100)
When DecodeAsn1BuildValue function fails, it may be necessary to
do some clean-up in the calling functions.

src/util-decode-der.c

index a076263657a1757e549a8768486d2947467aa796..363e6bc4db798e0e31005701d448f5ceb60d400a 100644 (file)
@@ -612,6 +612,7 @@ static Asn1Generic * DecodeAsn1DerSequence(const unsigned char *buffer, uint32_t
         numbytes = c & 0x7f;
         d_ptr++;
         if (DecodeAsn1BuildValue(&d_ptr, &d_length, numbytes) == -1) {
+            free(node);
             return NULL;
         }
     }
@@ -667,6 +668,7 @@ static Asn1Generic * DecodeAsn1DerSet(const unsigned char *buffer, uint32_t max_
         numbytes = c & 0x7f;
         d_ptr++;
         if (DecodeAsn1BuildValue(&d_ptr, &d_length, numbytes) == -1) {
+            free(node);
             return NULL;
         }
     }