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=25db8f968e8bded5375e3dc9ee4497bd29d41db8;p=rrdtool-all.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@2075 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_client.c b/program/src/rrd_client.c index b677d4f3..b895237c 100644 --- a/program/src/rrd_client.c +++ b/program/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); } }