Fix a number of small clang issues. Clang doesn't know we exit on malloc errors during init.

remotes/origin/master-1.1.x
Victor Julien 14 years ago
parent b600c9ac09
commit ac97bb7799

@ -177,7 +177,8 @@ void DetectCsumRegister (void)
* \param cd Pointer to the DetectCsumData structure that holds the keyword
* value sent as argument
*
* \retval 1 if the keyvalue has been parsed successfully, and 0 otherwise
* \retval 1 the keyvalue has been parsed successfully
* \retval 0 error
*/
static int DetectCsumParseArg(const char *key, DetectCsumData *cd)
{
@ -186,8 +187,12 @@ static int DetectCsumParseArg(const char *key, DetectCsumData *cd)
if (key[0] == '\"' && key[strlen(key) - 1] == '\"') {
str = SCStrdup(key + 1);
str[strlen(key) - 2] = '\0';
} else
} else {
str = SCStrdup(key);
}
if (str == NULL) {
goto error;
}
if (strcasecmp(str, DETECT_CSUM_VALID) == 0 ||
strcasecmp(str, DETECT_CSUM_INVALID) == 0) {
@ -196,7 +201,9 @@ static int DetectCsumParseArg(const char *key, DetectCsumData *cd)
return 1;
}
SCFree(str);
error:
if (str != NULL)
SCFree(str);
return 0;
}

@ -46,13 +46,17 @@ static int DetectRevSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawstr)
/* strip "'s */
if (rawstr[0] == '\"' && rawstr[strlen(rawstr)-1] == '\"') {
str = SCStrdup(rawstr+1);
if (str == NULL)
return -1;
str[strlen(rawstr)-2] = '\0';
dubbed = 1;
}
s->rev = (uint8_t)atoi(str);
if (dubbed) SCFree(str);
if (dubbed)
SCFree(str);
return 0;
}

@ -46,13 +46,17 @@ static int DetectSidSetup (DetectEngineCtx *de_ctx, Signature *s, char *sidstr)
/* strip "'s */
if (sidstr[0] == '\"' && sidstr[strlen(sidstr)-1] == '\"') {
str = SCStrdup(sidstr+1);
if (str == NULL)
return -1;
str[strlen(sidstr)-2] = '\0';
dubbed = 1;
}
s->id = (uint32_t)atoi(str);
if (dubbed) SCFree(str);
if (dubbed)
SCFree(str);
return 0;
}

Loading…
Cancel
Save