From: Swen Schillig Date: Mon, 30 Mar 2020 10:22:46 +0000 (+0200) Subject: ctdbd_conn: possible memleak in ctdbd_working X-Git-Tag: ldb-2.2.0~1131 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e146c855ac87fd78c873789b37227970b2fed96;p=thirdparty%2Fsamba.git ctdbd_conn: possible memleak in ctdbd_working 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 Reviewed-by: Volker Lendecke Reviewed-by: Martin Schwenke --- diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index db6ad9404d8..ec9b3a07812 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -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;