]> granicus.if.org Git - graphviz/commitdiff
common initAnchor: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 14 Oct 2022 04:01:28 +0000 (21:01 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 19 Oct 2022 02:18:49 +0000 (19:18 -0700)
lib/common/htmltable.c

index 960801f739b3ee88e86c85ae0f4742bd882ec312..47e2a9133d9f8b56c1d5f8bb62a36ad64e41eecf 100644 (file)
@@ -35,6 +35,7 @@
 #include <common/pointset.h>
 #include <common/intset.h>
 #include <cdt/cdt.h>
+#include <cgraph/alloc.h>
 #include <cgraph/itos.h>
 #include <cgraph/strcasecmp.h>
 #include <stddef.h>
@@ -391,7 +392,7 @@ initAnchor(GVJ_t * job, htmlenv_t * env, htmldata_t * data, boxf b,
     if (!id || !*id) {         /* no external id, so use the internal one */
        agxbinit(&xb, SMALLBUF, buf);
        if (!env->objid) {
-           env->objid = strdup(getObjId(job, obj->u.n, &xb));
+           env->objid = gv_strdup(getObjId(job, obj->u.n, &xb));
            env->objid_set = true;
        }
        agxbprint(&xb, "%s_%d", env->objid, anchorId++);