]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
utils: shut up a coverity warning (CID 155456)
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 30 Jun 2017 06:57:06 +0000 (08:57 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 30 Jun 2017 06:58:12 +0000 (08:58 +0200)
lib/utils.c

index 71f1c848849ab34b7d24719f95c1459c453b7ec0..11cd293df98f42e44d1f5225406986919f3e8435 100644 (file)
@@ -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);
 }