Fix for WIN32 memory leak in UpnpGetIfInfo()
@@ -3620,8 +3620,10 @@ int UpnpGetIfInfo(const char *IfName)
}
/* Copy interface name, if it was provided. */
if (IfName != NULL) {
- if (strlen(IfName) > sizeof(gIF_NAME))
+ if (strlen(IfName) > sizeof(gIF_NAME)) {
+ free(adapts);
return UPNP_E_INVALID_INTERFACE;
+ }
memset(gIF_NAME, 0, sizeof(gIF_NAME));
strncpy(gIF_NAME, IfName, sizeof(gIF_NAME) - 1);
@@ -3712,6 +3714,7 @@ int UpnpGetIfInfo(const char *IfName)
break;
}
}
+ free(adapts);
/* Failed to find a valid interface, or valid address. */
if (ifname_found == 0 || valid_addr_found == 0) {
UpnpPrintf(UPNP_CRITICAL,
