From: Vladimír Čunát Date: Fri, 30 Jun 2017 06:57:06 +0000 (+0200) Subject: utils: shut up a coverity warning (CID 155456) X-Git-Tag: v1.3.2~15^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a87a553349e9d77c68d38285607078a6861ddfe7;p=thirdparty%2Fknot-resolver.git utils: shut up a coverity warning (CID 155456) --- diff --git a/lib/utils.c b/lib/utils.c index 71f1c8488..11cd293df 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -565,7 +565,12 @@ int kr_ranked_rrarray_add(ranked_rr_array_t *array, const knot_rrset_t *rr, entry->cached = false; entry->yielded = false; entry->to_wire = to_wire; - array_push(*array, entry); + if (array_push(*array, entry) < 0) { + /* Silence coverity. It shouldn't be possible to happen, + * due to the array_reserve_mm call above. */ + mm_free(pool, entry); + return kr_error(ENOMEM); + } return to_wire_ensure_unique(array, array->len - 1); }