From: Ralph Boehme Date: Tue, 4 Sep 2018 10:47:42 +0000 (+0200) Subject: dbwrap_ctdb: simplify if condition X-Git-Tag: tdb-1.3.17~1637 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=daea9655ef9fc5a0b7b9389f9c4a4b4114261933;p=thirdparty%2Fsamba.git dbwrap_ctdb: simplify if condition This just moves the talloc_memdup() out of the if condition as per README.Coding. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index a5f27658a03..b8fedb7dcd2 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -1232,12 +1232,14 @@ again: result->value.dsize = ctdb_data.dsize - sizeof(crec->header); result->value.dptr = NULL; - if ((result->value.dsize != 0) - && !(result->value.dptr = (uint8_t *)talloc_memdup( - result, ctdb_data.dptr + sizeof(crec->header), - result->value.dsize))) { - DEBUG(0, ("talloc failed\n")); - TALLOC_FREE(result); + if (result->value.dsize != 0) { + result->value.dptr = talloc_memdup( + result, ctdb_data.dptr + sizeof(crec->header), + result->value.dsize); + if (result->value.dptr == NULL) { + DBG_ERR("talloc failed\n"); + TALLOC_FREE(result); + } } SAFE_FREE(ctdb_data.dptr);