From: Marek Schimara Date: Wed, 15 Jun 2016 13:31:27 +0000 (+0200) Subject: src/rrd_client.c: fix Coverity CID#32409 Missing unlock X-Git-Tag: v1.7.0~42^2~48 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=e656fa12a74579439c09efd1c3958b7cd468d926;p=thirdparty%2Frrdtool-1.x.git src/rrd_client.c: fix Coverity CID#32409 Missing unlock CWE-667 / https://cwe.mitre.org/data/definitions/667.html --- diff --git a/src/rrd_client.c b/src/rrd_client.c index d1fd435e..b9a4585e 100644 --- a/src/rrd_client.c +++ b/src/rrd_client.c @@ -1421,12 +1421,16 @@ int rrdc_fetch (const char *filename, /* {{{ */ status = buffer_add_string (file_path, &buffer_ptr, &buffer_free); free (file_path); - if (status != 0) + if (status != 0) { + mutex_unlock(&lock); return (ENOBUFS); + } status = buffer_add_string (cf, &buffer_ptr, &buffer_free); - if (status != 0) + if (status != 0) { + mutex_unlock(&lock); return (ENOBUFS); + } if ((ret_start != NULL) && (*ret_start > 0)) { @@ -1434,8 +1438,10 @@ int rrdc_fetch (const char *filename, /* {{{ */ snprintf (tmp, sizeof (tmp), "%lu", (unsigned long) *ret_start); tmp[sizeof (tmp) - 1] = 0; status = buffer_add_string (tmp, &buffer_ptr, &buffer_free); - if (status != 0) + if (status != 0) { + mutex_unlock(&lock); return (ENOBUFS); + } if ((ret_end != NULL) && (*ret_end > 0)) {