ctdb-common: Fix CID 1363227 Resource leak (RESOURCE_LEAK)
authorMartin Schwenke <martin@meltin.net>
Thu, 4 Aug 2016 05:50:12 +0000 (15:50 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 8 Aug 2016 06:17:34 +0000 (08:17 +0200)
Occurs on an invalid line that isn't the first.  Isn't really a leak
because it is allocated off mem_ctx, which should be freed by the
caller.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12110

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/system_util.c

index ea53f5d7d410a408d5774a96337c025a14764fb2..9fc6c444d601665f613b4c9a1a796f789b2122d7 100644 (file)
@@ -420,6 +420,7 @@ int ctdb_parse_connections(FILE *fp, TALLOC_CTX *mem_ctx,
                if (ret != 2) {
                        DEBUG(DEBUG_ERR, ("Bad line [%d]: %s\n",
                                          line_num, line));
+                       talloc_free(conn);
                        return EINVAL;
                }