summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2010-08-27 09:01:15 +0200
committerDanny Baumann <dannybaumann@web.de>2010-08-27 09:01:15 +0200
commite113f626b6bf16ddee49523a61894e223d13cbad (patch)
treef62f4332aea0ba901b06c9be027c213286693a3c
parent8d9fbe0d6cfd3e4416cca5609ca012f57b3adc25 (diff)
downloadsession-e113f626b6bf16ddee49523a61894e223d13cbad.tar.gz
session-e113f626b6bf16ddee49523a61894e223d13cbad.tar.bz2
Fix memory leak when deleting the last session entry.
-rw-r--r--session.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/session.c b/session.c
index 72297ad..8408992 100644
--- a/session.c
+++ b/session.c
@@ -151,23 +151,21 @@ sessionRemoveWindowListItem (SessionWindowList *item)
SESSION_CORE (&core);
- if (!sc->windowList)
- return;
-
if (sc->windowList == item)
sc->windowList = item->next;
else
{
- for (run = sc->windowList; run->next; run = run->next)
+ for (run = sc->windowList; run && run->next; run = run->next)
{
if (run->next == item)
{
run->next = item->next;
- sessionFreeWindowListItem (item);
break;
}
}
}
+
+ sessionFreeWindowListItem (item);
}
static char*