Skip to content

Commit 25a60e2

Browse files
author
Marc Stern
committed
Fixed 2 memory leaks
1 parent b3b33c9 commit 25a60e2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

apache2/re.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,13 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r
386386
} else {
387387

388388
target = strdup(p);
389-
if(target == NULL)
390-
return NULL;
389+
if(target == NULL) {
390+
if(target_list != NULL)
391+
free(target_list);
392+
if(replace != NULL)
393+
free(replace);
394+
return NULL;
395+
}
391396

392397
is_negated = is_counting = 0;
393398
param = name = value = NULL;
@@ -421,6 +426,8 @@ char *update_rule_target_ex(modsec_rec *msr, msre_ruleset *ruleset, msre_rule *r
421426
free(target_list);
422427
if(replace != NULL)
423428
free(replace);
429+
if(target != NULL)
430+
free(target);
424431
if(msr) {
425432
msr_log(msr, 9, "Error to update target - [%s] is not valid target", name);
426433
}

0 commit comments

Comments
 (0)