diff --git a/src/log-tlsstore.c b/src/log-tlsstore.c index 6648f592aa..861a2da69a 100644 --- a/src/log-tlsstore.c +++ b/src/log-tlsstore.c @@ -166,7 +166,6 @@ 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); @@ -223,7 +222,6 @@ 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++; @@ -338,6 +336,9 @@ static TmEcode LogTlsStoreLogThreadDeinit(ThreadVars *t, void *data) return TM_ECODE_OK; } + if (aft->enc_buf != NULL) + SCFree(aft->enc_buf); + /* clear memory */ memset(aft, 0, sizeof(LogTlsStoreLogThread));