Fix for #156: UPnP segfault when no valid UPnP IGDs are found.
This commit is contained in:
parent
973800b52f
commit
f285d4f4f3
1 changed files with 4 additions and 2 deletions
6
net.cpp
6
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,7 +938,8 @@ 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 || !fUseUPnP)
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue