aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-03-06 13:35:42 +0100
committerMax Kellermann <max@duempel.org>2014-03-06 13:35:42 +0100
commitf2f1801c25e3d8d936fcd828a14f5af6d3d862c9 (patch)
tree87e9856fb9f708c3ceb54a1ffcf117bf76c61164 /src
parent9da57e7458ed2e539ba1693ca748c0e5c7969585 (diff)
downloadmpd-f2f1801c25e3d8d936fcd828a14f5af6d3d862c9.tar.gz
mpd-f2f1801c25e3d8d936fcd828a14f5af6d3d862c9.tar.xz
mpd-f2f1801c25e3d8d936fcd828a14f5af6d3d862c9.zip
db/proxy: check connect error before initializing SocketMonitor
Fixes crash bug because mpd_connection_get_async() was called without a connection.
Diffstat (limited to 'src')
-rw-r--r--src/db/plugins/ProxyDatabasePlugin.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx
index e46b4b9e8..0ab25005a 100644
--- a/src/db/plugins/ProxyDatabasePlugin.cxx
+++ b/src/db/plugins/ProxyDatabasePlugin.cxx
@@ -353,19 +353,19 @@ ProxyDatabase::Connect(Error &error)
return false;
}
+ if (!CheckError(connection, error)) {
+ mpd_connection_free(connection);
+ connection = nullptr;
+
+ return false;
+ }
+
idle_received = unsigned(-1);
is_idle = false;
SocketMonitor::Open(mpd_async_get_fd(mpd_connection_get_async(connection)));
IdleMonitor::Schedule();
- if (!CheckError(connection, error)) {
- if (connection != nullptr)
- Disconnect();
-
- return false;
- }
-
return true;
}