]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdbd_conn: possible memleak in ctdbd_working
authorSwen Schillig <swen@linux.ibm.com>
Mon, 30 Mar 2020 10:22:46 +0000 (12:22 +0200)
committerMartin Schwenke <martins@samba.org>
Thu, 2 Apr 2020 09:51:39 +0000 (09:51 +0000)
A cstatus != 0 does not guarantee to have no received data
referenced by outdata.dptr.
Therefore, make sure outdata.dptr is free'd.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
source3/lib/ctdbd_conn.c

index db6ad9404d8ab57c62fb719e5db80905245aecc5..ec9b3a078127a56000ca0c10991e07928452f51f 100644 (file)
@@ -242,7 +242,7 @@ static int get_cluster_vnn(struct ctdbd_connection *conn, uint32_t *vnn)
 static bool ctdbd_working(struct ctdbd_connection *conn, uint32_t vnn)
 {
        int32_t cstatus=-1;
-       TDB_DATA outdata;
+       TDB_DATA outdata = {0};
        struct ctdb_node_map_old *m;
        bool ok = false;
        uint32_t i;
@@ -256,7 +256,7 @@ static bool ctdbd_working(struct ctdbd_connection *conn, uint32_t vnn)
        }
        if ((cstatus != 0) || (outdata.dptr == NULL)) {
                DEBUG(2, ("Received invalid ctdb data\n"));
-               return false;
+               goto fail;
        }
 
        m = (struct ctdb_node_map_old *)outdata.dptr;