Remove useless allocation and free.
Found by cppcheck as a potential issue:
src/detect-engine-address-ipv6.c:385:12: warning: Either the condition 'tmp!=NULL' is redundant or there is possible null pointer dereference: tmp. [nullPointerRedundantCheck]
memset(tmp,0,sizeof(DetectAddress));
^
src/detect-engine-address-ipv6.c:525:13: note: Assuming that condition 'tmp!=NULL' is not redundant
if (tmp != NULL)
^
src/detect-engine-address-ipv6.c:385:12: note: Null pointer dereference
memset(tmp,0,sizeof(DetectAddress));
^
But code turned out not to do anything, so removed.
Bug: #5291.
(cherry picked from commit
bad900516133a81afb0a6d3982fa3de5871e6ba7)
uint32_t b_ip2[4] = { SCNtohl(b->ip2.addr_data32[0]), SCNtohl(b->ip2.addr_data32[1]),
SCNtohl(b->ip2.addr_data32[2]), SCNtohl(b->ip2.addr_data32[3]) };
- DetectAddress *tmp = NULL;
-
/* default to NULL */
*c = NULL;
goto error;
}
- /* get a place to temporary put sigs lists */
- tmp = DetectAddressInit();
- if (tmp == NULL)
- goto error;
- memset(tmp,0,sizeof(DetectAddress));
-
/* we have 3 parts: [aaa[abab]bbb]
* part a: a_ip1 <-> b_ip1 - 1
* part b: b_ip1 <-> a_ip2
}
}
- if (tmp != NULL)
- DetectAddressFree(tmp);
-
return 0;
error:
- if (tmp != NULL)
- DetectAddressFree(tmp);
return -1;
}