From 5194f95d6f57ead016f5e84b46e125d693b3a107 Mon Sep 17 00:00:00 2001 From: Alex Murray Date: Tue, 29 Jun 2010 00:29:02 +0930 Subject: hddtemp-plugin: close socket fd if connect fails to avoid leaking fd --- plugins/hddtemp/hddtemp-plugin.c | 1 + 1 file changed, 1 insertion(+) 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)); -- cgit v1.2.1