From: oetiker Date: Fri, 30 Apr 2010 15:50:16 +0000 (+0000) Subject: rrd_client.c: explicitly close the connection on error in X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cfd2c9261db2efcbf26be324049920e7ec221aba;p=rrdtool.git rrd_client.c: explicitly close the connection on error in response_read. I've found it to get stuck otherwise. -- Thorsten von Eicken git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4/program@2075 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_client.c b/src/rrd_client.c index 471e046..308965e 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -245,14 +245,17 @@ static int response_read (rrdc_response_t **ret_response) /* {{{ */ ret->lines_num = 0; buffer_ptr = fgets (buffer, sizeof (buffer), sh); - if (buffer_ptr == NULL) + if (buffer_ptr == NULL) { + close_connection(); return (-3); + } chomp (buffer); ret->status = strtol (buffer, &ret->message, 0); if (buffer == ret->message) { response_free (ret); + close_connection(); return (-4); } /* Skip leading whitespace of the status message */ @@ -270,6 +273,7 @@ static int response_read (rrdc_response_t **ret_response) /* {{{ */ if (ret->lines == NULL) { response_free (ret); + close_connection(); return (-5); } memset (ret->lines, 0, sizeof (char *) * ret->status); @@ -281,6 +285,7 @@ static int response_read (rrdc_response_t **ret_response) /* {{{ */ if (buffer_ptr == NULL) { response_free (ret); + close_connection(); return (-6); } chomp (buffer); @@ -289,6 +294,7 @@ static int response_read (rrdc_response_t **ret_response) /* {{{ */ if (ret->lines[i] == NULL) { response_free (ret); + close_connection(); return (-7); } }