util-host-os-info: scan-build fix

util-host-os-info.c:202:13: warning: Potential leak of memory pointed to by 'user_data'
            SCLogError(SC_ERR_INVALID_IPV6_ADDR, "Invalid IPV6 address inside");
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./util-debug.h:278:35: note: expanded from macro 'SCLogError'
 #define SCLogError(err_code, ...) SCLogErr(SC_LOG_ERROR, err_code, \
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./util-debug.h:214:82: note: expanded from macro 'SCLogErr'
                                  char _sc_log_err_msg[SC_LOG_MAX_LOG_MSG_LEN] = ""; \
                                                                                 ^~
1 warning generated.
pull/809/merge
Victor Julien 12 years ago
parent a6474bd6bf
commit 0cf71befbb

@ -176,6 +176,7 @@ int SCHInfoAddHostOSInfo(char *host_os, char *host_os_ip_range, int is_ipv4)
/* if we are here, we have an IPV4 address */
if ( (ipv4_addr = ValidateIPV4Address(ip_str)) == NULL) {
SCLogError(SC_ERR_INVALID_IPV4_ADDR, "Invalid IPV4 address");
SCHInfoFreeUserDataOSPolicy(user_data);
SCFree(ip_str);
return -1;
}
@ -187,6 +188,7 @@ int SCHInfoAddHostOSInfo(char *host_os, char *host_os_ip_range, int is_ipv4)
netmask_value = atoi(netmask_str);
if (netmask_value < 0 || netmask_value > 32) {
SCLogError(SC_ERR_INVALID_IP_NETBLOCK, "Invalid IPV4 Netblock");
SCHInfoFreeUserDataOSPolicy(user_data);
SCFree(ipv4_addr);
SCFree(ip_str);
return -1;
@ -200,6 +202,7 @@ int SCHInfoAddHostOSInfo(char *host_os, char *host_os_ip_range, int is_ipv4)
/* if we are here, we have an IPV6 address */
if ( (ipv6_addr = ValidateIPV6Address(ip_str)) == NULL) {
SCLogError(SC_ERR_INVALID_IPV6_ADDR, "Invalid IPV6 address inside");
SCHInfoFreeUserDataOSPolicy(user_data);
SCFree(ip_str);
return -1;
}
@ -211,6 +214,7 @@ int SCHInfoAddHostOSInfo(char *host_os, char *host_os_ip_range, int is_ipv4)
netmask_value = atoi(netmask_str);
if (netmask_value < 0 || netmask_value > 128) {
SCLogError(SC_ERR_INVALID_IP_NETBLOCK, "Invalid IPV6 Netblock");
SCHInfoFreeUserDataOSPolicy(user_data);
SCFree(ipv6_addr);
SCFree(ip_str);
return -1;

Loading…
Cancel
Save