From: Michal Nowak Date: Thu, 12 Dec 2024 16:42:50 +0000 (+0100) Subject: Drop superfluous isc_mem_get() NULL check X-Git-Tag: v9.20.5~12^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=75931127ac2156a3b6ac69d00b655ee9021cd510;p=thirdparty%2Fbind9.git Drop superfluous isc_mem_get() NULL check coccinelle v1.1 trips over a superfluous isc_mem_get() NULL check in tests/libtest/ns.c and reports the following failure in CI: EXN: Failure("rule starting on line 26: already tagged token:\nC code context\nFile \"./tests/libtest/ns.c\", line 350, column 1, charpos = 7939\n around = 'if',\n whole content = \tif (qctx != NULL) {") in ./tests/libtest/ns.c (cherry picked from commit cf76851c7543c6dc5bf3468f9f1af017d1df5343) --- diff --git a/tests/libtest/ns.c b/tests/libtest/ns.c index d4e62132ff8..a7cca1a4e44 100644 --- a/tests/libtest/ns.c +++ b/tests/libtest/ns.c @@ -357,15 +357,9 @@ extract_qctx(void *arg, void *data, isc_result_t *resultp) { * gets unwound. */ qctx = isc_mem_get(mctx, sizeof(*qctx)); - if (qctx != NULL) { - memmove(qctx, (query_ctx_t *)arg, sizeof(*qctx)); - } + memmove(qctx, (query_ctx_t *)arg, sizeof(*qctx)); qctxp = (query_ctx_t **)data; - /* - * If memory allocation failed, the supplied pointer will simply be set - * to NULL. We rely on the user of this hook to react properly. - */ *qctxp = qctx; *resultp = ISC_R_UNSET;