]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/file: fix minor scan-build warnings
authorVictor Julien <victor@inliniac.net>
Wed, 12 Sep 2018 12:47:55 +0000 (14:47 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 17 Sep 2018 06:27:24 +0000 (08:27 +0200)
src/detect-engine-filedata.c
src/detect-fileext.c
src/detect-filemagic.c
src/detect-filename.c

index d20a56d30fb634dc66571c106654714a894c50d5..dfe0bef5166fbe5fe06c4d6674d8f72a310ffb68 100644 (file)
@@ -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;
index 817a5fe859f8141594e978fee0bb35407e20b8b6..aea104c371e0cd6464e421d2eab07adbd856cb95 100644 (file)
@@ -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
index 205156c4ea187cb8644bbcc8c1f76dc1ba2d7650..ff596e7c2fa240f30b26029106fe5ae92d18902d 100644 (file)
@@ -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
index 56578bfb40aea4dacae7ee9f507a17273c7df812..9bb6b1c124e016a41a84d345e965ce5508d96eb2 100644 (file)
@@ -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