From: Amitay Isaacs Date: Thu, 4 Aug 2016 05:46:33 +0000 (+1000) Subject: ctdb-tools: Fix CID 1364702 - resource leak X-Git-Tag: tevent-0.9.30~216 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10019f7cdfa4b3f5485f063d409aa55ca5f14f6a;p=thirdparty%2Fsamba.git ctdb-tools: Fix CID 1364702 - resource leak BUG: https://bugzilla.samba.org/show_bug.cgi?id=12121 Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke --- diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 085a84fb084..c3003926a4e 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -5450,11 +5450,13 @@ static int control_tfetch(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, nwritten = sys_write(fd, data.dptr, data.dsize); if (nwritten != data.dsize) { fprintf(stderr, "Failed to write record to file\n"); + close(fd); goto fail; } close(fd); } + fail: ret = ctdb_ltdb_header_extract(&data, &header); if (ret != 0) {