diff --git a/src/detect-threshold.c b/src/detect-threshold.c index 65d6aec323..b3d7d5122c 100644 --- a/src/detect-threshold.c +++ b/src/detect-threshold.c @@ -121,6 +121,8 @@ static DetectThresholdData *DetectThresholdParse (char *rawstr) int i = 0; copy_str = SCStrdup(rawstr); + if (copy_str == NULL) + goto error; for(pos = 0, threshold_opt = strtok(copy_str,","); pos < strlen(copy_str) && threshold_opt != NULL; pos++, threshold_opt = strtok(NULL,",")) { @@ -134,8 +136,7 @@ static DetectThresholdData *DetectThresholdParse (char *rawstr) track_found++; } - if(copy_str) - SCFree(copy_str); + SCFree(copy_str); if(count_found != 1 || second_found != 1 || type_found != 1 || track_found != 1) goto error;