ctdb-daemon: Fix maybe-uninitialized error with picky developer
authorAmitay Isaacs <amitay@gmail.com>
Fri, 1 Mar 2019 03:18:31 +0000 (14:18 +1100)
committerJeremy Allison <jra@samba.org>
Fri, 1 Mar 2019 17:21:15 +0000 (17:21 +0000)
263/386] Compiling ctdb/server/ctdb_recovery_helper.c
In file included from ../../server/ctdb_recovery_helper.c:24:0:
../../server/ctdb_recovery_helper.c: In function ‘main’:
../../../lib/talloc/talloc.h:911:34: error: ‘mem_ctx’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define TALLOC_FREE(ctx) do { if (ctx != NULL) { talloc_free(ctx); ctx=NULL; } } while(0)

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
ctdb/server/ctdb_recovery_helper.c

index 57e12b4703738235d3d6c26de1cb9bc585441fe6..eed71da5df8db8c49732b5db3e77c9c39914ddb2 100644 (file)
@@ -2737,7 +2737,7 @@ int main(int argc, char *argv[])
 {
        int write_fd;
        const char *sockpath;
-       TALLOC_CTX *mem_ctx;
+       TALLOC_CTX *mem_ctx = NULL;
        struct tevent_context *ev;
        struct ctdb_client_context *client;
        int ret = 0;