diff options
author | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-08-19 21:14:29 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@gmail.com> | 2008-08-19 21:14:29 +0200 |
commit | 7aa4c62d92e17347cc331316a0d4c838e133e6a9 (patch) | |
tree | 49f743c48765a3133c1c74e863002d232902b1d9 | |
parent | 0afb0992eef469356d0675cc928777f3d8bb80d7 (diff) | |
download | pianobar-windows-7aa4c62d92e17347cc331316a0d4c838e133e6a9.tar.gz pianobar-windows-7aa4c62d92e17347cc331316a0d4c838e133e6a9.tar.bz2 pianobar-windows-7aa4c62d92e17347cc331316a0d4c838e133e6a9.zip |
Fix missing initializing in BarSettingsDestroy which caused segfault
Thereby avoid freeing a NULL pointer
-rw-r--r-- | src/settings.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/settings.c b/src/settings.c index e756364..663a21a 100644 --- a/src/settings.c +++ b/src/settings.c @@ -63,13 +63,17 @@ void BarSettingsInit (BarSettings_t *settings) { } void BarSettingsDestroy (BarSettings_t *settings) { - BarKeyShortcut_t *curShortcut, *lastShortcut; + BarKeyShortcut_t *curShortcut = settings->keys, *lastShortcut; while (curShortcut != NULL) { lastShortcut = curShortcut; curShortcut = curShortcut->next; - free (lastShortcut->description); - free (lastShortcut->configKey); + if (lastShortcut->description != NULL) { + free (lastShortcut->description); + } + if (lastShortcut->configKey != NULL) { + free (lastShortcut->configKey); + } free (lastShortcut); } free (settings->controlProxy); |