From: Victor Julien Date: Wed, 12 Sep 2018 12:47:55 +0000 (+0200) Subject: detect/file: fix minor scan-build warnings X-Git-Tag: suricata-4.1.0-rc2~81 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=164252e381b75e3b6a67b0b283263418fb156d95;p=thirdparty%2Fsuricata.git detect/file: fix minor scan-build warnings --- diff --git a/src/detect-engine-filedata.c b/src/detect-engine-filedata.c index d20a56d30f..dfe0bef516 100644 --- a/src/detect-engine-filedata.c +++ b/src/detect-engine-filedata.c @@ -44,12 +44,13 @@ static InspectionBuffer *GetBuffer(InspectionBufferMultipleForList *fb, uint32_t uint32_t grow_by = new_size - old_size; SCLogDebug("size is %u, need %u, so growing by %u", old_size, new_size, grow_by); + SCLogDebug("fb->inspection_buffers %p", fb->inspection_buffers); void *ptr = SCRealloc(fb->inspection_buffers, (id + 1) * sizeof(InspectionBuffer)); if (ptr == NULL) return NULL; InspectionBuffer *to_zero = (InspectionBuffer *)ptr + old_size; - SCLogDebug("fb->inspection_buffers %p ptr %p to_zero %p", fb->inspection_buffers, ptr, to_zero); + SCLogDebug("ptr %p to_zero %p", ptr, to_zero); memset((uint8_t *)to_zero, 0, (grow_by * sizeof(InspectionBuffer))); fb->inspection_buffers = ptr; fb->size = new_size; diff --git a/src/detect-fileext.c b/src/detect-fileext.c index 817a5fe859..aea104c371 100644 --- a/src/detect-fileext.c +++ b/src/detect-fileext.c @@ -166,6 +166,7 @@ static DetectFileextData *DetectFileextParse (const char *str, bool negate) memcpy(ext, fileext->ext, fileext->len); ext[fileext->len] = '\0'; SCLogDebug("will look for fileext %s", ext); + SCFree(ext); } } #endif diff --git a/src/detect-filemagic.c b/src/detect-filemagic.c index 205156c4ea..ff596e7c2f 100644 --- a/src/detect-filemagic.c +++ b/src/detect-filemagic.c @@ -211,6 +211,7 @@ static int DetectFilemagicMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx, memcpy(name, filemagic->name, filemagic->len); name[filemagic->len] = '\0'; SCLogDebug("will look for filemagic %s", name); + SCFree(name); } } #endif @@ -271,6 +272,7 @@ static DetectFilemagicData *DetectFilemagicParse (const char *str, bool negate) memcpy(name, filemagic->name, filemagic->len); name[filemagic->len] = '\0'; SCLogDebug("will look for filemagic %s", name); + SCFree(name); } } #endif diff --git a/src/detect-filename.c b/src/detect-filename.c index 56578bfb40..9bb6b1c124 100644 --- a/src/detect-filename.c +++ b/src/detect-filename.c @@ -147,6 +147,7 @@ static int DetectFilenameMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx, memcpy(name, filename->name, filename->len); name[filename->len] = '\0'; SCLogDebug("will look for filename %s", name); + SCFree(name); } } #endif @@ -208,6 +209,7 @@ static DetectFilenameData *DetectFilenameParse (const char *str, bool negate) memcpy(name, filename->name, filename->len); name[filename->len] = '\0'; SCLogDebug("will look for filename %s", name); + SCFree(name); } } #endif