1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

WINGs: Fix memory leak in wtokenfree()

wtokenfree() does not free the first entry of an array.
If count is 1 then

   while (--count)

will be

   while (0)

and the inner body of that while-loop will not be entered.
Therefore a memory leak happens every time wtokenfree() is called.

Retrieved-from: http://paldium.homeunix.org/tobias/wmaker/patches/

[crmafra: This patch, altough correct, breaks WPrefs.app, which will be
fixed by the next patch. ]
This commit is contained in:
Tobias Stoeckmann
2007-02-18 03:47:47 +01:00
committed by Carlos R. Mafra
parent 3a0eb643d9
commit e522ca734d

View File

@@ -140,7 +140,7 @@ char *wtokenjoin(char **list, int count)
void wtokenfree(char **tokens, int count) void wtokenfree(char **tokens, int count)
{ {
while (--count) while (count--)
wfree(tokens[count]); wfree(tokens[count]);
wfree(tokens); wfree(tokens);
} }