aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/net.cpp b/net.cpp
index 833aafc0a1..a403655660 100644
--- a/net.cpp
+++ b/net.cpp
@@ -906,7 +906,8 @@ void ThreadMapPort2(void* parg)
struct IGDdatas data;
int r;
- if (UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)) == 1)
+ r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
+ if (r == 1)
{
char intClient[16];
char intPort[6];
@@ -937,9 +938,10 @@ void ThreadMapPort2(void* parg)
} else {
printf("No valid UPnP IGDs found\n");
freeUPNPDevlist(devlist); devlist = 0;
- FreeUPNPUrls(&urls);
+ if (r != 0)
+ FreeUPNPUrls(&urls);
loop {
- if (fShutdown)
+ if (fShutdown || !fUseUPnP)
return;
Sleep(2000);
}