diff --git a/src/detect-engine-address.c b/src/detect-engine-address.c index b90a23a8cf..75ed73fce7 100644 --- a/src/detect-engine-address.c +++ b/src/detect-engine-address.c @@ -596,11 +596,11 @@ static void DetectAddressParseIPv6CIDR(int cidr, struct in6_addr *in6) */ int DetectAddressParseString(DetectAddress *dd, char *str) { - char *ipdup = SCStrdup(str); char *ip = NULL; char *ip2 = NULL; char *mask = NULL; int r = 0; + char *ipdup = SCStrdup(str); if (unlikely(ipdup == NULL)) return -1; @@ -618,9 +618,6 @@ int DetectAddressParseString(DetectAddress *dd, char *str) /* we dup so we can put a nul-termination in it later */ ip = ipdup; - if (ip == NULL) { - goto error; - } /* handle the negation case */ if (ip[0] == '!') { diff --git a/src/detect-engine-iponly.c b/src/detect-engine-iponly.c index c14c610d22..af3c05030f 100644 --- a/src/detect-engine-iponly.c +++ b/src/detect-engine-iponly.c @@ -102,11 +102,11 @@ static uint8_t IPOnlyCIDRItemCompare(IPOnlyCIDRItem *head, */ static int IPOnlyCIDRItemParseSingle(IPOnlyCIDRItem *dd, char *str) { - char *ipdup = SCStrdup(str); char *ip = NULL; char *ip2 = NULL; char *mask = NULL; int r = 0; + char *ipdup = SCStrdup(str); if (unlikely(ipdup == NULL)) return -1; @@ -135,9 +135,6 @@ static int IPOnlyCIDRItemParseSingle(IPOnlyCIDRItem *dd, char *str) /* we dup so we can put a nul-termination in it later */ ip = ipdup; - if (ip == NULL) { - goto error; - } /* handle the negation case */ if (ip[0] == '!') { diff --git a/src/detect-engine-port.c b/src/detect-engine-port.c index 1b8c10445e..cb0c03b49b 100644 --- a/src/detect-engine-port.c +++ b/src/detect-engine-port.c @@ -1379,13 +1379,14 @@ error: * \retval NULL on error */ DetectPort *PortParse(char *str) { - char *portdup = SCStrdup(str); char *port2 = NULL; DetectPort *dp = NULL; + char *portdup = SCStrdup(str); if (unlikely(portdup == NULL)) { return NULL; } + dp = DetectPortInit(); if (dp == NULL) goto error; @@ -1394,9 +1395,6 @@ DetectPort *PortParse(char *str) { /* we dup so we can put a nul-termination in it later */ char *port = portdup; - if (port == NULL) { - goto error; - } /* handle the negation case */ if (port[0] == '!') {