From 8d5752eae7010d626f76c5f7fbd3d19861841bfe 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(+) (limited to 'plugins/hddtemp/hddtemp-plugin.c') 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