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.verplant.org/?a=commitdiff_plain;h=252efcd3f319d99dbf700aa4d53da8945dc8725f;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/trunk/program@2075 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_client.c b/src/rrd_client.c index b677d4f..b895237 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -376,14 +376,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 */ @@ -401,6 +404,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); @@ -412,6 +416,7 @@ static int response_read (rrdc_response_t **ret_response) /* {{{ */ if (buffer_ptr == NULL) { response_free (ret); + close_connection(); return (-6); } chomp (buffer); @@ -420,6 +425,7 @@ static int response_read (rrdc_response_t **ret_response) /* {{{ */ if (ret->lines[i] == NULL) { response_free (ret); + close_connection(); return (-7); } }