diff options
author | Max Kellermann <max@duempel.org> | 2008-09-21 22:42:51 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-21 22:42:51 +0200 |
commit | 85877791beb48d083d7dd8c60d017500cc68496d (patch) | |
tree | 56f6548f92a89d233a328e1e797fcbb6794fa7c9 /src | |
parent | 1e23badc0bbd7615d65e4e2aa3814db29b7c8b70 (diff) | |
download | mpd-85877791beb48d083d7dd8c60d017500cc68496d.tar.gz mpd-85877791beb48d083d7dd8c60d017500cc68496d.tar.xz mpd-85877791beb48d083d7dd8c60d017500cc68496d.zip |
mpdclient: fix memory leak in mpdclient_finish_command()
During authentication, the message pointer was allocated, but never
freed. Allocate it only if it is really used (and freed).
Diffstat (limited to 'src')
-rw-r--r-- | src/mpdclient.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mpdclient.c b/src/mpdclient.c index c15c34d6d..fcdaa4ef4 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -123,16 +123,17 @@ mpdclient_finish_command(mpdclient_t *c) mpd_finishCommand(c->connection); if (c->connection->error) { - gchar *msg = locale_to_utf8(c->connection->errorStr); gint error = c->connection->error; - - if (error == MPD_ERROR_ACK) - error = error | (c->connection->errorCode << 8); + gchar *msg; if (c->connection->errorCode == MPD_ACK_ERROR_PERMISSION && screen_auth(c) == 0) return 0; + if (error == MPD_ERROR_ACK) + error = error | (c->connection->errorCode << 8); + + msg = locale_to_utf8(c->connection->errorStr); error_cb(c, error, msg); g_free(msg); return error; |