diff options
author | Alex Murray <[email protected]> | 2010-06-29 00:29:02 +0930 |
---|---|---|
committer | infirit <[email protected]> | 2015-07-07 15:36:36 +0200 |
commit | 5194f95d6f57ead016f5e84b46e125d693b3a107 (patch) | |
tree | 474fba50949a489a6242cb33d1166b161b2bcb85 | |
parent | 2e65c105d4ce4c71475b41ab3c69570b9f2ade27 (diff) | |
download | mate-sensors-applet-5194f95d6f57ead016f5e84b46e125d693b3a107.tar.bz2 mate-sensors-applet-5194f95d6f57ead016f5e84b46e125d693b3a107.tar.xz |
hddtemp-plugin: close socket fd if connect fails to avoid leaking fd
-rw-r--r-- | plugins/hddtemp/hddtemp-plugin.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/plugins/hddtemp/hddtemp-plugin.c b/plugins/hddtemp/hddtemp-plugin.c index af37bb3..8fdd6a3 100644 --- a/plugins/hddtemp/hddtemp-plugin.c +++ b/plugins/hddtemp/hddtemp-plugin.c @@ -97,6 +97,7 @@ static const gchar *hddtemp_plugin_query_hddtemp_daemon(GError **error) { if (connect(sockfd, (struct sockaddr *)&address, (socklen_t)sizeof(address)) == -1) { g_set_error(error, SENSORS_APPLET_PLUGIN_ERROR, HDDTEMP_SOCKET_CONNECT_ERROR, "Error connecting to hddtemp daemon on port %i on %s", htons(HDDTEMP_PORT_NUMBER), HDDTEMP_SERVER_IP_ADDRESS); + close(sockfd); return NULL; } memset(buffer, 0, sizeof(buffer)); |