]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Dead code cleanup. Coverity 728047, 728048, 728049.
authorVictor Julien <victor@inliniac.net>
Thu, 27 Sep 2012 10:53:54 +0000 (12:53 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 27 Sep 2012 10:53:54 +0000 (12:53 +0200)
src/detect-engine-address.c
src/detect-engine-iponly.c
src/detect-engine-port.c

index b90a23a8cfff4e4595909fef5850a9a1021c6db3..75ed73fce7b484470d44dc28adb504639c01fd6e 100644 (file)
@@ -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] == '!') {
index c14c610d2208e96d7df080f3021cad6a8386dab6..af3c05030fa7d7fd6f65d64f7ccfed570fa843ef 100644 (file)
@@ -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] == '!') {
index 1b8c10445ea841414b8a35bcab8b71234b6d2726..cb0c03b49b053e313733450488ea534fcd35e9d9 100644 (file)
@@ -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] == '!') {