[PATCH] Simplify ctdbd_conn.c a bit

Jeremy Allison jra at samba.org
Mon Jul 13 18:33:28 UTC 2015


On Sat, Jul 11, 2015 at 03:55:47PM +0200, Volker Lendecke wrote:
> Hi!
> 
> Review&push appreciated!

LGTM except for one comment. In :

commit e168e5799e91b24cd60470221c4f4f5f5b7410d2
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jun 23 17:04:59 2015 +0200

    ctdbd_conn: Do an early return from ctdb_read_req
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index e2b564e..77e4e0e 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -423,7 +423,11 @@ static int ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid,
                        goto next_pkt;
                }
 
-               ctdbd_msg_call_back(conn, msg);
+               ret = ctdbd_msg_call_back(conn, msg);
+               if (ret != 0) {
+                       return ret;
+               }
+
                TALLOC_FREE(hdr);
                goto next_pkt;

Shouldn't you also call:

TALLOC_FREE(hdr);

before return ret ?

I know it'll get cleaned up when mem_ctx gets
free'd, so I'm OK pushing it without, but as
you explicitly added a TALLOC_FREE(hdr) earlier
in the patchset in:

commit 8256560f4c6ad81efd39bcebf752342f738f5989
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jul 1 17:00:43 2015 +0200

    ctdbd_conn: Fix a memleak

I thought you might want it here also.



More information about the samba-technical mailing list