]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
tlsstore: fix memleak
authorMats Klepsland <mats.klepsland@gmail.com>
Fri, 13 May 2016 06:00:19 +0000 (08:00 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 17 May 2016 10:27:05 +0000 (12:27 +0200)
Bug #1771.

Direct leak of 1834 byte(s) in 1 object(s) allocated from:
    #0 0x4e2e65 in realloc ??:?
    #1 0xcec27b in LogTlsLogPem /home/mats/suricata/src/log-tlsstore.c:130
    #2 0xcea4f5 in LogTlsStoreLogger /home/mats/suricata/src/log-tlsstore.c:303
    #3 0xd8b99c in OutputPacketLog /home/mats/suricata/src/output-packet.c:104

src/log-tlsstore.c

index a572a627ac8858b0a855d9f35f5fa3066647a953..317f80ffc4b7cac6b134dcaf7a5c97e4930ead8a 100644 (file)
@@ -166,6 +166,7 @@ static void LogTlsLogPem(LogTlsStoreLogThread *aft, const Packet *p, SSLState *s
             goto end_fwrite_fp;
     }
     fclose(fp);
+    SCFree(aft->enc_buf);
 
     //Logging certificate informations
     memcpy(filename + (strlen(filename) - 3), "meta", 4);
@@ -222,6 +223,7 @@ static void LogTlsLogPem(LogTlsStoreLogThread *aft, const Packet *p, SSLState *s
 
 end_fwrite_fp:
     fclose(fp);
+    SCFree(aft->enc_buf);
     if (logging_dir_not_writable < LOGGING_WRITE_ISSUE_LIMIT) {
         SCLogWarning(SC_ERR_FWRITE, "Unable to write certificate");
         logging_dir_not_writable++;