summaryrefslogtreecommitdiff
path: root/plugins/hddtemp
diff options
context:
space:
mode:
authorAlex Murray <[email protected]>2010-06-29 00:29:02 +0930
committermonsta <[email protected]>2015-07-10 11:07:05 +0300
commit8d5752eae7010d626f76c5f7fbd3d19861841bfe (patch)
treef14b034912aad9c736d1a7352b5dcfc00325fe07 /plugins/hddtemp
parent22e467495f3953d8537ebd4b33ccb584918b3e23 (diff)
downloadmate-sensors-applet-8d5752eae7010d626f76c5f7fbd3d19861841bfe.tar.bz2
mate-sensors-applet-8d5752eae7010d626f76c5f7fbd3d19861841bfe.tar.xz
hddtemp-plugin: close socket fd if connect fails to avoid leaking fd
Diffstat (limited to 'plugins/hddtemp')
-rw-r--r--plugins/hddtemp/hddtemp-plugin.c1
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));