summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-08-14 08:52:01 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-08-14 08:52:01 +0200
commit35d9d257865103f0c9004908990b27975bfc7696 (patch)
treedd110371126e09cf209391f609e1e8732e264371
parent95d3383fd3996c8a181c04379f6ff57a685933d3 (diff)
downloadpianobar-windows-35d9d257865103f0c9004908990b27975bfc7696.tar.gz
pianobar-windows-35d9d257865103f0c9004908990b27975bfc7696.tar.bz2
pianobar-windows-35d9d257865103f0c9004908990b27975bfc7696.zip
Fix reading from freed pointer
Introduced by commit 4878f5911d05af7bfa1917daf984dab0fd07eb42
-rw-r--r--src/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index a2a169d..45cbc4c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -152,7 +152,7 @@ PianoStation_t **BarSortedStations (PianoStation_t *unsortedStations) {
*/
PianoStation_t *BarUiSelectStation (PianoHandle_t *ph,
const char *prompt) {
- PianoStation_t **ss = NULL, **ssCurr = NULL;
+ PianoStation_t **ss = NULL, **ssCurr = NULL, *retStation;
int i = 0;
ss = BarSortedStations (ph->stations);
@@ -175,8 +175,9 @@ PianoStation_t *BarUiSelectStation (PianoHandle_t *ph,
ssCurr++;
i--;
}
+ retStation = *ssCurr;
free (ss);
- return *ssCurr;
+ return retStation;
}
/* let user pick one song