From 4307ea23482d9971b63ebd93faa75ea9cca00ac8 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Thu, 22 Sep 2011 17:32:28 +0530 Subject: [PATCH] Replace all frees with SCFrees --- src/alert-debuglog.c | 2 +- src/alert-fastlog.c | 2 +- src/alert-prelude.c | 2 +- src/alert-syslog.c | 2 +- src/alert-unified-alert.c | 7 ++++--- src/alert-unified-log.c | 7 ++++--- src/alert-unified2-alert.c | 7 ++++--- src/app-layer-dcerpc-udp.c | 8 ++++---- src/app-layer-dcerpc.c | 4 ++-- src/app-layer-smb.c | 6 +++--- src/cuda-packet-batcher.c | 16 +++++++-------- src/detect-bytejump.c | 2 +- src/detect-parse.c | 6 +++--- src/detect-ssl-state.c | 12 +++++------ src/log-droplog.c | 2 +- src/log-httplog.c | 2 +- src/log-pcap.c | 6 +++--- src/util-classification-config.c | 18 ++++++++--------- src/util-cuda-handlers.c | 10 +++++----- src/util-debug.c | 34 ++++++++++++++++---------------- src/util-mpm-ac-gfbs.c | 2 +- src/util-mpm-ac.c | 4 ++-- src/util-mpm-b2g-cuda.c | 14 ++++++------- src/util-profiling.c | 4 ++-- 24 files changed, 91 insertions(+), 88 deletions(-) diff --git a/src/alert-debuglog.c b/src/alert-debuglog.c index 3961285c2c..11f1ad18fa 100644 --- a/src/alert-debuglog.c +++ b/src/alert-debuglog.c @@ -458,7 +458,7 @@ static void AlertDebugLogDeInitCtx(OutputCtx *output_ctx) if (logfile_ctx != NULL) { LogFileFreeCtx(logfile_ctx); } - free(output_ctx); + SCFree(output_ctx); } } diff --git a/src/alert-fastlog.c b/src/alert-fastlog.c index 52e5b84d78..a291dbd63a 100644 --- a/src/alert-fastlog.c +++ b/src/alert-fastlog.c @@ -372,7 +372,7 @@ static void AlertFastLogDeInitCtx(OutputCtx *output_ctx) { LogFileCtx *logfile_ctx = (LogFileCtx *)output_ctx->data; LogFileFreeCtx(logfile_ctx); - free(output_ctx); + SCFree(output_ctx); } /** \brief Read the config set the file pointer, open the file diff --git a/src/alert-prelude.c b/src/alert-prelude.c index bf3b8b38ae..a875da40af 100644 --- a/src/alert-prelude.c +++ b/src/alert-prelude.c @@ -877,7 +877,7 @@ static void AlertPreludeDeinitCtx(OutputCtx *output_ctx) AlertPreludeCtx *ctx = (AlertPreludeCtx *)output_ctx->data; prelude_client_destroy(ctx->client, PRELUDE_CLIENT_EXIT_STATUS_SUCCESS); - free(output_ctx); + SCFree(output_ctx); } void AlertPreludeRegisterTests (void) { diff --git a/src/alert-syslog.c b/src/alert-syslog.c index db67c78ad4..aa59802bd9 100644 --- a/src/alert-syslog.c +++ b/src/alert-syslog.c @@ -181,7 +181,7 @@ static void AlertSyslogDeInitCtx(OutputCtx *output_ctx) if (logfile_ctx != NULL) { LogFileFreeCtx(logfile_ctx); } - free(output_ctx); + SCFree(output_ctx); } closelog(); } diff --git a/src/alert-unified-alert.c b/src/alert-unified-alert.c index a89d2641d5..fe3a9e25e0 100644 --- a/src/alert-unified-alert.c +++ b/src/alert-unified-alert.c @@ -371,7 +371,7 @@ static void AlertUnifiedAlertDeInitCtx(OutputCtx *output_ctx) if (logfile_ctx != NULL) { LogFileFreeCtx(logfile_ctx); } - free(output_ctx); + SCFree(output_ctx); } } @@ -460,7 +460,7 @@ static int AlertUnifiedAlertTestRotate01(void) if (ret == TM_ECODE_FAILED) { LogFileFreeCtx(lf); if (filename != NULL) - free(filename); + SCFree(filename); return 0; } @@ -478,7 +478,8 @@ static int AlertUnifiedAlertTestRotate01(void) error: AlertUnifiedAlertThreadDeinit(&tv, data); if (oc != NULL) AlertUnifiedAlertDeInitCtx(oc); - if (filename != NULL) free(filename); + if (filename != NULL) + SCFree(filename); return r; } #endif /* UNITTESTS */ diff --git a/src/alert-unified-log.c b/src/alert-unified-log.c index edd2792482..248e5f236c 100644 --- a/src/alert-unified-log.c +++ b/src/alert-unified-log.c @@ -427,7 +427,7 @@ static void AlertUnifiedLogDeInitCtx(OutputCtx *output_ctx) if (logfile_ctx != NULL) { LogFileFreeCtx(logfile_ctx); } - free(output_ctx); + SCFree(output_ctx); } } @@ -514,7 +514,7 @@ static int AlertUnifiedLogTestRotate01(void) if (ret == TM_ECODE_FAILED) { LogFileFreeCtx(lf); if (filename != NULL) - free(filename); + SCFree(filename); return 0; } @@ -532,7 +532,8 @@ static int AlertUnifiedLogTestRotate01(void) error: AlertUnifiedLogThreadDeinit(&tv, data); if (oc != NULL) AlertUnifiedLogDeInitCtx(oc); - if (filename != NULL) free(filename); + if (filename != NULL) + SCFree(filename); return r; } #endif /* UNITTESTS */ diff --git a/src/alert-unified2-alert.c b/src/alert-unified2-alert.c index 44337277af..01a3de3bd8 100644 --- a/src/alert-unified2-alert.c +++ b/src/alert-unified2-alert.c @@ -913,7 +913,7 @@ static void Unified2AlertDeInitCtx(OutputCtx *output_ctx) if (logfile_ctx != NULL) { LogFileFreeCtx(logfile_ctx); } - free(output_ctx); + SCFree(output_ctx); } } @@ -1444,7 +1444,7 @@ static int Unified2TestRotate01(void) if (ret == TM_ECODE_FAILED) { LogFileFreeCtx(lf); if (filename != NULL) - free(filename); + SCFree(filename); return 0; } @@ -1465,7 +1465,8 @@ static int Unified2TestRotate01(void) error: Unified2AlertThreadDeinit(&tv, data); if (oc != NULL) Unified2AlertDeInitCtx(oc); - if (filename != NULL) free(filename); + if (filename != NULL) + SCFree(filename); return r; } #endif diff --git a/src/app-layer-dcerpc-udp.c b/src/app-layer-dcerpc-udp.c index a64465bab8..f11c5c7ef1 100644 --- a/src/app-layer-dcerpc-udp.c +++ b/src/app-layer-dcerpc-udp.c @@ -692,20 +692,20 @@ static void DCERPCUDPStateFree(void *s) { while ((item = TAILQ_FIRST(&sstate->uuid_list))) { //printUUID("Free", item); TAILQ_REMOVE(&sstate->uuid_list, item, next); - free(item); + SCFree(item); } if (sstate->dcerpc.dcerpcrequest.stub_data_buffer != NULL) { - free(sstate->dcerpc.dcerpcrequest.stub_data_buffer); + SCFree(sstate->dcerpc.dcerpcrequest.stub_data_buffer); sstate->dcerpc.dcerpcrequest.stub_data_buffer = NULL; sstate->dcerpc.dcerpcrequest.stub_data_buffer_len = 0; } if (sstate->dcerpc.dcerpcresponse.stub_data_buffer != NULL) { - free(sstate->dcerpc.dcerpcresponse.stub_data_buffer); + SCFree(sstate->dcerpc.dcerpcresponse.stub_data_buffer); sstate->dcerpc.dcerpcresponse.stub_data_buffer = NULL; sstate->dcerpc.dcerpcresponse.stub_data_buffer_len = 0; } if (s) { - free(s); + SCFree(s); s = NULL; } } diff --git a/src/app-layer-dcerpc.c b/src/app-layer-dcerpc.c index 6a08e75d7e..38cffccee7 100644 --- a/src/app-layer-dcerpc.c +++ b/src/app-layer-dcerpc.c @@ -1793,12 +1793,12 @@ static void DCERPCStateFree(void *s) { } if (sstate->dcerpc.dcerpcrequest.stub_data_buffer != NULL) { - free(sstate->dcerpc.dcerpcrequest.stub_data_buffer); + SCFree(sstate->dcerpc.dcerpcrequest.stub_data_buffer); sstate->dcerpc.dcerpcrequest.stub_data_buffer = NULL; sstate->dcerpc.dcerpcrequest.stub_data_buffer_len = 0; } if (sstate->dcerpc.dcerpcresponse.stub_data_buffer != NULL) { - free(sstate->dcerpc.dcerpcresponse.stub_data_buffer); + SCFree(sstate->dcerpc.dcerpcresponse.stub_data_buffer); sstate->dcerpc.dcerpcresponse.stub_data_buffer = NULL; sstate->dcerpc.dcerpcresponse.stub_data_buffer_len = 0; } diff --git a/src/app-layer-smb.c b/src/app-layer-smb.c index 29789f9bb2..001451810e 100644 --- a/src/app-layer-smb.c +++ b/src/app-layer-smb.c @@ -1291,15 +1291,15 @@ static void SMBStateFree(void *s) { while ((item = TAILQ_FIRST(&sstate->dcerpc.dcerpcbindbindack.uuid_list))) { //printUUID("Free", item); TAILQ_REMOVE(&sstate->dcerpc.dcerpcbindbindack.uuid_list, item, next); - free(item); + SCFree(item); } if (sstate->dcerpc.dcerpcrequest.stub_data_buffer != NULL) { - free(sstate->dcerpc.dcerpcrequest.stub_data_buffer); + SCFree(sstate->dcerpc.dcerpcrequest.stub_data_buffer); sstate->dcerpc.dcerpcrequest.stub_data_buffer = NULL; sstate->dcerpc.dcerpcrequest.stub_data_buffer_len = 0; } if (sstate->dcerpc.dcerpcresponse.stub_data_buffer != NULL) { - free(sstate->dcerpc.dcerpcresponse.stub_data_buffer); + SCFree(sstate->dcerpc.dcerpcresponse.stub_data_buffer); sstate->dcerpc.dcerpcresponse.stub_data_buffer = NULL; sstate->dcerpc.dcerpcresponse.stub_data_buffer_len = 0; } diff --git a/src/cuda-packet-batcher.c b/src/cuda-packet-batcher.c index b219f971f9..67d17e91e8 100644 --- a/src/cuda-packet-batcher.c +++ b/src/cuda-packet-batcher.c @@ -420,9 +420,9 @@ void SCCudaPBDeAllocSCCudaPBPacketsBuffer(SCCudaPBPacketsBuffer *pb) } } if (pb->packets_address_buffer != NULL) - free(pb->packets_address_buffer); + SCFree(pb->packets_address_buffer); - free(pb); + SCFree(pb); return; } @@ -844,7 +844,7 @@ TmEcode SCCudaPBThreadDeInit(ThreadVars *tv, void *data) SCLogError(SC_ERR_CUDA_HANDLER_ERROR, "Failed to deregister module"); } } - free(tctx); + SCFree(tctx); } return TM_ECODE_OK; @@ -949,7 +949,7 @@ void SCCudaPBCleanUpQueuesAndBuffers(void) "packets_buffer"); } } else { - free(pb->packets_buffer); + SCFree(pb->packets_buffer); } } if (pb->packets_offset_buffer != NULL) { @@ -959,7 +959,7 @@ void SCCudaPBCleanUpQueuesAndBuffers(void) "packets_offset_buffer"); } } else { - free(pb->packets_offset_buffer); + SCFree(pb->packets_offset_buffer); } } if (pb->packets_payload_offset_buffer != NULL) { @@ -969,11 +969,11 @@ void SCCudaPBCleanUpQueuesAndBuffers(void) "packets_payload_offset_buffer"); } } else { - free(pb->packets_payload_offset_buffer); + SCFree(pb->packets_payload_offset_buffer); } } - free(pb); + SCFree(pb); } SCMutexUnlock(&dq->mutex_q); SCCondSignal(&dq->cond_q); @@ -1001,7 +1001,7 @@ void SCCudaPBCleanUpQueuesAndBuffers(void) } } - free(pb); + SCFree(pb); } if (SCCudaCtxPopCurrent(NULL) == -1){ SCLogError(SC_ERR_CUDA_ERROR, "Could not pop cuda context"); diff --git a/src/detect-bytejump.c b/src/detect-bytejump.c index e7ab4596f4..46e81c3159 100644 --- a/src/detect-bytejump.c +++ b/src/detect-bytejump.c @@ -1182,7 +1182,7 @@ int DetectByteJumpTestPacket03(void) end: if (buf != NULL) - free(buf); + SCFree(buf); return result; } diff --git a/src/detect-parse.c b/src/detect-parse.c index a544ce1f66..20197de106 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -1709,7 +1709,7 @@ error: void DetectParseDupSigFreeFunc(void *data) { if (data != NULL) - free(data); + SCFree(data); return; } @@ -1803,7 +1803,7 @@ error: void DetectParseDupSigHashFree(DetectEngineCtx *de_ctx) { if (de_ctx->dup_sig_hash_table != NULL) - free(de_ctx->dup_sig_hash_table); + SCFree(de_ctx->dup_sig_hash_table); de_ctx->dup_sig_hash_table = NULL; @@ -1929,7 +1929,7 @@ static inline int DetectEngineSignatureIsDuplicate(DetectEngineCtx *de_ctx, /* this is duplicate, but a duplicate that replaced the existing sig entry */ ret = 2; - free(sw); + SCFree(sw); end: return ret; diff --git a/src/detect-ssl-state.c b/src/detect-ssl-state.c index b06ffb6d83..28171d558a 100644 --- a/src/detect-ssl-state.c +++ b/src/detect-ssl-state.c @@ -348,7 +348,7 @@ int DetectSslStateTest01(void) return 0; } if (ssd->flags == DETECT_SSL_STATE_CLIENT_HELLO) { - free(ssd); + SCFree(ssd); return 1; } @@ -364,7 +364,7 @@ int DetectSslStateTest02(void) } if (ssd->flags == (DETECT_SSL_STATE_SERVER_HELLO | DETECT_SSL_STATE_CLIENT_HELLO)) { - free(ssd); + SCFree(ssd); return 1; } @@ -382,7 +382,7 @@ int DetectSslStateTest03(void) if (ssd->flags == (DETECT_SSL_STATE_SERVER_HELLO | DETECT_SSL_STATE_CLIENT_KEYX | DETECT_SSL_STATE_CLIENT_HELLO)) { - free(ssd); + SCFree(ssd); return 1; } @@ -403,7 +403,7 @@ int DetectSslStateTest04(void) DETECT_SSL_STATE_CLIENT_HELLO | DETECT_SSL_STATE_SERVER_KEYX | DETECT_SSL_STATE_UNKNOWN)) { - free(ssd); + SCFree(ssd); return 1; } @@ -418,7 +418,7 @@ int DetectSslStateTest05(void) if (ssd != NULL) { printf("ssd != NULL - failure\n"); - free(ssd); + SCFree(ssd); return 0; } @@ -432,7 +432,7 @@ int DetectSslStateTest06(void) "unknown | "); if (ssd != NULL) { printf("ssd != NULL - failure\n"); - free(ssd); + SCFree(ssd); return 0; } diff --git a/src/log-droplog.c b/src/log-droplog.c index e9a991c561..3af20854dc 100644 --- a/src/log-droplog.c +++ b/src/log-droplog.c @@ -190,7 +190,7 @@ static void LogDropLogDeInitCtx(OutputCtx *output_ctx) if (logfile_ctx != NULL) { LogFileFreeCtx(logfile_ctx); } - free(output_ctx); + SCFree(output_ctx); } } diff --git a/src/log-httplog.c b/src/log-httplog.c index 3e43bd5cad..a5d46f83f3 100644 --- a/src/log-httplog.c +++ b/src/log-httplog.c @@ -449,7 +449,7 @@ static void LogHttpLogDeInitCtx(OutputCtx *output_ctx) { LogFileCtx *logfile_ctx = (LogFileCtx *)output_ctx->data; LogFileFreeCtx(logfile_ctx); - free(output_ctx); + SCFree(output_ctx); } /** \brief Read the config set the file pointer, open the file diff --git a/src/log-pcap.c b/src/log-pcap.c index b4d46c74ec..efd81f5d4e 100644 --- a/src/log-pcap.c +++ b/src/log-pcap.c @@ -274,14 +274,14 @@ TmEcode PcapLogThreadDeinit(ThreadVars *t, void *data) /* clear memory */ memset(pl, 0, sizeof(PcapLogThread)); - free(pl); + SCFree(pl); return TM_ECODE_OK; error: /* clear memory */ if (pl != NULL) { memset(pl, 0, sizeof(PcapLogThread)); - free(pl); + SCFree(pl); } return TM_ECODE_FAILED; } @@ -381,7 +381,7 @@ static void PcapLogFileDeInitCtx(OutputCtx *output_ctx) if (logfile_ctx != NULL) { LogFileFreeCtx(logfile_ctx); } - free(output_ctx); + SCFree(output_ctx); } } diff --git a/src/util-classification-config.c b/src/util-classification-config.c index 67d5db3029..b6b185e65e 100644 --- a/src/util-classification-config.c +++ b/src/util-classification-config.c @@ -257,20 +257,20 @@ int SCClassConfAddClasstype(char *rawstr, uint8_t index, DetectEngineCtx *de_ctx SCLogDebug("HashTable Add failed"); } else { SCLogDebug("Duplicate classtype found inside classification.config"); - if (ct_new->classtype_desc) free(ct_new->classtype_desc); - if (ct_new->classtype) free (ct_new->classtype); - free(ct_new); + if (ct_new->classtype_desc) SCFree(ct_new->classtype_desc); + if (ct_new->classtype) SCFree(ct_new->classtype); + SCFree(ct_new); } - if (ct_name) free((char *)ct_name); - if (ct_desc) free((char *)ct_desc); - if (ct_priority_str) free((char *)ct_priority_str); + if (ct_name) SCFree((char *)ct_name); + if (ct_desc) SCFree((char *)ct_desc); + if (ct_priority_str) SCFree((char *)ct_priority_str); return 0; error: - if (ct_name) free((char *)ct_name); - if (ct_desc) free((char *)ct_desc); - if (ct_priority_str) free((char *)ct_priority_str); + if (ct_name) SCFree((char *)ct_name); + if (ct_desc) SCFree((char *)ct_desc); + if (ct_priority_str) SCFree((char *)ct_priority_str); return -1; } diff --git a/src/util-cuda-handlers.c b/src/util-cuda-handlers.c index a9165cd122..a62a987a54 100644 --- a/src/util-cuda-handlers.c +++ b/src/util-cuda-handlers.c @@ -181,7 +181,7 @@ void SCCudaHlCleanProfiles(void) MpmCudaConfCleanup(profile->data); } } - free(profile); + SCFree(profile); profile = profile_next; } cuda_profiles = NULL; @@ -495,7 +495,7 @@ int SCCudaHlGetCudaModule(CUmodule *p_module, const char *ptx_image, int handle) SCLogDebug("Loading kernel module: %s\n",image); if (SCCudaModuleLoadData(p_module, (void *)SCCudaPtxDumpGetModule(image)) == -1) goto error; - free(image); + SCFree(image); new_module_cumodule->cuda_module = p_module[0]; new_module_cumodule->cuda_module_handle = SCCudaHlGetUniqueHandle(); @@ -514,7 +514,7 @@ int SCCudaHlGetCudaModule(CUmodule *p_module, const char *ptx_image, int handle) return new_module_cumodule->cuda_module_handle; error: - free(image); + SCFree(image); return -1; } @@ -733,8 +733,8 @@ int SCCudaHlFreeCudaDevicePtr(const char *name, int handle, int cumodule_handle) } temp_module_device_ptr->next = temp_module_device_ptr->next->next; } - free(module_device_ptr->name); - free(module_device_ptr); + SCFree(module_device_ptr->name); + SCFree(module_device_ptr); return 0; diff --git a/src/util-debug.c b/src/util-debug.c index bc5d09fa19..437a53456f 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -311,7 +311,7 @@ SCError SCLogMessage(SCLogLevel log_level, char **msg, const char *file, SC_LOG_MAX_LOG_MSG_LEN); *msg = *msg + SC_LOG_MAX_LOG_MSG_LEN; if (temp_fmt_h != NULL) - free(temp_fmt_h); + SCFree(temp_fmt_h); return SC_OK; } switch(temp_fmt[1]) { @@ -433,7 +433,7 @@ SCError SCLogMessage(SCLogLevel log_level, char **msg, const char *file, SC_LOG_MAX_LOG_MSG_LEN); *msg = *msg + SC_LOG_MAX_LOG_MSG_LEN; if (temp_fmt_h != NULL) - free(temp_fmt_h); + SCFree(temp_fmt_h); return SC_OK; } cw = snprintf(temp, SC_LOG_MAX_LOG_MSG_LEN - (temp - *msg), "%s", substr); @@ -445,19 +445,19 @@ SCError SCLogMessage(SCLogLevel log_level, char **msg, const char *file, SC_LOG_MAX_LOG_MSG_LEN); *msg = *msg + SC_LOG_MAX_LOG_MSG_LEN; if (temp_fmt_h != NULL) - free(temp_fmt_h); + SCFree(temp_fmt_h); return SC_OK; } *msg = temp; - free(temp_fmt_h); + SCFree(temp_fmt_h); return SC_OK; error: if (temp_fmt != NULL) - free(temp_fmt_h); + SCFree(temp_fmt_h); return SC_ERR_SPRINTF; } @@ -577,11 +577,11 @@ static inline SCLogOPIfaceCtx *SCLogInitFileOPIface(const char *file, error: if (iface_ctx->file != NULL) { - free((char *)iface_ctx->file); + SCFree((char *)iface_ctx->file); iface_ctx->file = NULL; } if (iface_ctx->log_format != NULL) { - free((char *)iface_ctx->log_format); + SCFree((char *)iface_ctx->log_format); iface_ctx->log_format = NULL; } if (iface_ctx->file_d != NULL) { @@ -701,10 +701,10 @@ static inline void SCLogFreeLogOPIfaceCtx(SCLogOPIfaceCtx *iface_ctx) fclose(iface_ctx->file_d); if (iface_ctx->file != NULL) - free((void *)iface_ctx->file); + SCFree((void *)iface_ctx->file); if (iface_ctx->log_format != NULL) - free((void *)iface_ctx->log_format); + SCFree((void *)iface_ctx->log_format); if (iface_ctx->iface == SC_LOG_OP_IFACE_SYSLOG) { closelog(); @@ -712,7 +712,7 @@ static inline void SCLogFreeLogOPIfaceCtx(SCLogOPIfaceCtx *iface_ctx) iface_ctx = iface_ctx->next; - free(temp); + SCFree(temp); } return; @@ -952,11 +952,11 @@ void SCLogFreeLogInitData(SCLogInitData *sc_lid) { if (sc_lid != NULL) { if (sc_lid->startup_message != NULL) - free(sc_lid->startup_message); + SCFree(sc_lid->startup_message); if (sc_lid->global_log_format != NULL) - free(sc_lid->global_log_format); + SCFree(sc_lid->global_log_format); if (sc_lid->op_filter != NULL) - free(sc_lid->op_filter); + SCFree(sc_lid->op_filter); SCLogFreeLogOPIfaceCtx(sc_lid->op_ifaces); } @@ -971,12 +971,12 @@ static inline void SCLogFreeLogConfig(SCLogConfig *sc_lc) { if (sc_lc != NULL) { if (sc_lc->startup_message != NULL) - free(sc_lc->startup_message); + SCFree(sc_lc->startup_message); if (sc_lc->log_format != NULL) - free(sc_lc->log_format); + SCFree(sc_lc->log_format); SCLogFreeLogOPIfaceCtx(sc_lc->op_ifaces); - free(sc_lc); + SCFree(sc_lc); } return; @@ -1215,7 +1215,7 @@ void SCLogLoadConfig(void) //exit(1); /* \todo Can we free sc_lid now? */ if (sc_lid != NULL) - free(sc_lid); + SCFree(sc_lid); } /** diff --git a/src/util-mpm-ac-gfbs.c b/src/util-mpm-ac-gfbs.c index 8d3b51baef..6bd172d7ad 100644 --- a/src/util-mpm-ac-gfbs.c +++ b/src/util-mpm-ac-gfbs.c @@ -905,7 +905,7 @@ static inline void SCACGfbsPrepareStateTable(MpmCtx *mpm_ctx) SCACGfbsInsertCaseSensitiveEntriesForPatterns(mpm_ctx); /* we don't need this anymore */ - free(ctx->goto_table); + SCFree(ctx->goto_table); ctx->goto_table = NULL; return; diff --git a/src/util-mpm-ac.c b/src/util-mpm-ac.c index 7b514c77c5..c505a27c04 100644 --- a/src/util-mpm-ac.c +++ b/src/util-mpm-ac.c @@ -931,9 +931,9 @@ static inline void SCACPrepareStateTable(MpmCtx *mpm_ctx) #endif /* we don't need these anymore */ - free(ctx->goto_table); + SCFree(ctx->goto_table); ctx->goto_table = NULL; - free(ctx->failure_table); + SCFree(ctx->failure_table); ctx->failure_table = NULL; return; diff --git a/src/util-mpm-b2g-cuda.c b/src/util-mpm-b2g-cuda.c index fde0663a56..b308f9b5c2 100644 --- a/src/util-mpm-b2g-cuda.c +++ b/src/util-mpm-b2g-cuda.c @@ -1631,7 +1631,7 @@ static int B2gCudaMpmStreamDataDeInit(B2gCudaMpmThreadCtxData *tctx, MpmCudaConf goto error; } } else { - free(sd->results_buffer); + SCFree(sd->results_buffer); } SCCudaHlFreeCudaDevicePtr("MPM_B2G_RESULTS", tctx->b2g_cuda_module_handle, @@ -1650,7 +1650,7 @@ static int B2gCudaMpmStreamDataDeInit(B2gCudaMpmThreadCtxData *tctx, MpmCudaConf sd->b2g_cuda_cumodule_handle); } - free(tctx->stream_data); + SCFree(tctx->stream_data); return 0; @@ -1801,7 +1801,7 @@ TmEcode B2gCudaMpmDispThreadDeInit(ThreadVars *tv, void *data) goto error; } - free(tctx); + SCFree(tctx); if (SCCudaCtxPopCurrent(NULL) == -1) { SCLogError(SC_ERR_B2G_CUDA_ERROR, "Error popping cuda context"); @@ -2669,7 +2669,7 @@ static int B2gCudaTest02(void) end: for (i = 0; i < no_of_pkts; i++) { - free(p[i]); + SCFree(p[i]); } SCCudaPBCleanUpQueuesAndBuffers(); if (de_ctx != NULL) { @@ -2989,7 +2989,7 @@ static int B2gCudaTest03(void) end: for (i = 0; i < no_of_pkts; i++) { - free(p[i]); + SCFree(p[i]); } SCCudaPBCleanUpQueuesAndBuffers(); if (de_ctx) { @@ -3331,7 +3331,7 @@ static int B2gCudaTest04(void) end: for (i = 0; i < no_of_pkts; i++) { - free(p[i]); + SCFree(p[i]); } SCCudaPBCleanUpQueuesAndBuffers(); if (de_ctx) { @@ -3703,7 +3703,7 @@ static int B2gCudaTest05(void) end: for (i = 0; i < no_of_pkts; i++) { - free(p[i]); + SCFree(p[i]); } SCCudaPBCleanUpQueuesAndBuffers(); if (de_ctx) { diff --git a/src/util-profiling.c b/src/util-profiling.c index 8de2c702c5..44ba394b63 100644 --- a/src/util-profiling.c +++ b/src/util-profiling.c @@ -1201,10 +1201,10 @@ ProfilingGenericTicksTest01(void) { ticks_start = UtilCpuGetTicks(); for (i = 0; i < TEST_RUNS; i++) { - free(ptr[i]); + SCFree(ptr[i]); } ticks_end = UtilCpuGetTicks(); - printf("free(1024) %"PRIu64"\n", (ticks_end - ticks_start)/TEST_RUNS); + printf("SCFree(1024) %"PRIu64"\n", (ticks_end - ticks_start)/TEST_RUNS); SCMutex m[TEST_RUNS];