From: Matthew Fernandez Date: Mon, 21 Jun 2021 00:48:41 +0000 (-0700) Subject: remove redundant error check in gvNEWcontext X-Git-Tag: 2.48.0~29^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4bc5cd64691ed43e3ba2b0d217bde88e0d48a3d0;p=graphviz remove redundant error check in gvNEWcontext The zmalloc function calls exit() on failure, so there is not need to check its return value for out-of-memory. --- diff --git a/lib/gvc/gvcontext.c b/lib/gvc/gvcontext.c index e8735514f..9dc5cd287 100644 --- a/lib/gvc/gvcontext.c +++ b/lib/gvc/gvcontext.c @@ -50,12 +50,11 @@ GVC_t *gvNEWcontext(const lt_symlist_t *builtins, int demand_loading) { GVC_t *gvc = zmalloc(sizeof(GVC_t)); - if (gvc) { - gvc->common.info = LibInfo; - gvc->common.errorfn = agerrorf; - gvc->common.builtins = builtins; - gvc->common.demand_loading = demand_loading; - } + gvc->common.info = LibInfo; + gvc->common.errorfn = agerrorf; + gvc->common.builtins = builtins; + gvc->common.demand_loading = demand_loading; + return gvc; }