detect/file: fix minor scan-build warnings

pull/3479/head
Victor Julien 7 years ago
parent 11f213fb80
commit 164252e381

@ -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;

@ -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

@ -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

@ -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

Loading…
Cancel
Save