/**
* \brief this function will SCFree memory associated with DetectContentData
*
- * \param cd pointer to DetectCotentData
+ * \param cd pointer to DetectContentData
*/
void DetectContentFree(void *ptr)
{
{
uint8_t *content = NULL;
uint16_t len = 0;
- SigMatch *pm = NULL;
- DetectContentData *ud = NULL;
if (s->init_data->negated) {
SCLogError(SC_ERR_INVALID_VALUE, "Can't negate replacement string: %s",
replacestr);
- goto error;
+ return -1;
}
int ret = DetectContentDataParse("replace", replacestr, &content, &len);
if (ret == -1)
- goto error;
+ return -1;
switch (run_mode) {
case RUNMODE_NFQ:
}
/* add to the latest "content" keyword from pmatch */
- pm = DetectGetLastSMByListId(s, DETECT_SM_LIST_PMATCH,
+ const SigMatch *pm = DetectGetLastSMByListId(s, DETECT_SM_LIST_PMATCH,
DETECT_CONTENT, -1);
if (pm == NULL) {
SCLogError(SC_ERR_WITHIN_MISSING_CONTENT, "replace needs"
}
/* we can remove this switch now with the unified structure */
- ud = (DetectContentData *)pm->ctx;
+ DetectContentData *ud = (DetectContentData *)pm->ctx;
if (ud == NULL) {
SCLogError(SC_ERR_INVALID_ARGUMENT, "invalid argument");
SCFree(content);
return 0;
error:
+ SCFree(ud->replace);
+ ud->replace = NULL;
SCFree(content);
return -1;
}