From e656fa12a74579439c09efd1c3958b7cd468d926 Mon Sep 17 00:00:00 2001 From: Marek Schimara Date: Wed, 15 Jun 2016 15:31:27 +0200 Subject: [PATCH] src/rrd_client.c: fix Coverity CID#32409 Missing unlock CWE-667 / https://cwe.mitre.org/data/definitions/667.html --- src/rrd_client.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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)) { -- 2.47.2