1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
Description: Fix "TimerThreadRemove failed!" message resulting because eventId is uninitialised.
Author: Nye Liu <nyet@nyet.org>
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720495
Bug: http://sourceforge.net/p/linux-igd/bugs/7/
Forwarded: yes
Modified by NJL to maintain pmlist_Current (even though it's not used)
Index: linux-igd-1.0+cvs20070630-libupnp6/pmlist.c
===================================================================
--- linux-igd-1.0+cvs20070630-libupnp6.orig/pmlist.c 2014-10-07 23:35:53.000000000 +0100
+++ linux-igd-1.0+cvs20070630-libupnp6/pmlist.c 2014-10-07 23:35:54.000000000 +0100
@@ -18,7 +18,7 @@
char *externalPort, char *internalPort,
char *protocol, char *internalClient, char *desc)
{
- struct portMap* temp = (struct portMap*) malloc(sizeof(struct portMap));
+ struct portMap* temp = (struct portMap*) calloc(1, sizeof(struct portMap));
temp->m_PortMappingEnabled = enabled;
@@ -35,6 +35,7 @@
if (strlen(desc) < sizeof(temp->m_PortMappingDescription)) strcpy(temp->m_PortMappingDescription, desc);
else strcpy(temp->m_PortMappingDescription, "");
temp->m_PortMappingLeaseDuration = duration;
+ temp->expirationEventId = -1;
temp->next = NULL;
temp->prev = NULL;
@@ -190,7 +191,7 @@
temp = pmlist_Find(item->m_ExternalPort, item->m_PortMappingProtocol, item->m_InternalClient);
if (temp) // We found the item to delete
{
- CancelMappingExpiration(temp->expirationEventId);
+ CancelMappingExpiration(temp->expirationEventId);
pmlist_DeletePortMapping(item->m_PortMappingEnabled, item->m_PortMappingProtocol, item->m_ExternalPort,
item->m_InternalClient, item->m_InternalPort);
if (temp == pmlist_Head) // We are the head of the list
@@ -205,6 +206,7 @@
{
pmlist_Head = temp->next;
pmlist_Head->prev = NULL;
+ pmlist_Current = temp->next; // We put current to the right after a extraction
free (temp);
action_succeeded = 1;
}
@@ -212,8 +214,8 @@
else if (temp == pmlist_Tail) // We are the Tail, but not the Head so we have prev
{
pmlist_Tail = pmlist_Tail->prev;
- free (pmlist_Tail->next);
- pmlist_Tail->next = NULL;
+ pmlist_Tail->next = pmlist_Current = NULL;
+ free (temp);
action_succeeded = 1;
}
else // We exist and we are between two nodes
|