From 89d117ced0138d345ce082ef582a790aa6451a0f Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 15 Oct 2022 11:06:32 -0700 Subject: [PATCH] common emit_begin_edge: fix unchecked allocation failures --- lib/common/emit.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/common/emit.c b/lib/common/emit.c index cfee1b400..d03b54940 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -2556,23 +2556,23 @@ static void emit_begin_edge(GVJ_t * job, edge_t * e, char** styles) if (((s = agget(e, "edgehref")) && s[0]) || ((s = agget(e, "edgeURL")) && s[0])) obj->url = strdup_and_subst_obj(s, e); else if (dflt_url) - obj->url = strdup(dflt_url); + obj->url = gv_strdup(dflt_url); if (((s = agget(e, "labelhref")) && s[0]) || ((s = agget(e, "labelURL")) && s[0])) obj->labelurl = strdup_and_subst_obj(s, e); else if (dflt_url) - obj->labelurl = strdup(dflt_url); + obj->labelurl = gv_strdup(dflt_url); if (((s = agget(e, "tailhref")) && s[0]) || ((s = agget(e, "tailURL")) && s[0])) { obj->tailurl = strdup_and_subst_obj(s, e); obj->explicit_tailurl = true; } else if (dflt_url) - obj->tailurl = strdup(dflt_url); + obj->tailurl = gv_strdup(dflt_url); if (((s = agget(e, "headhref")) && s[0]) || ((s = agget(e, "headURL")) && s[0])) { obj->headurl = strdup_and_subst_obj(s, e); obj->explicit_headurl = true; } else if (dflt_url) - obj->headurl = strdup(dflt_url); + obj->headurl = gv_strdup(dflt_url); } if (flags & GVRENDER_DOES_TARGETS) { @@ -2583,23 +2583,23 @@ static void emit_begin_edge(GVJ_t * job, edge_t * e, char** styles) obj->target = strdup_and_subst_obj(s, e); } else if (dflt_target) - obj->target = strdup(dflt_target); + obj->target = gv_strdup(dflt_target); if ((s = agget(e, "labeltarget")) && s[0]) obj->labeltarget = strdup_and_subst_obj(s, e); else if (dflt_target) - obj->labeltarget = strdup(dflt_target); + obj->labeltarget = gv_strdup(dflt_target); if ((s = agget(e, "tailtarget")) && s[0]) { obj->tailtarget = strdup_and_subst_obj(s, e); obj->explicit_tailtarget = true; } else if (dflt_target) - obj->tailtarget = strdup(dflt_target); + obj->tailtarget = gv_strdup(dflt_target); if ((s = agget(e, "headtarget")) && s[0]) { obj->explicit_headtarget = true; obj->headtarget = strdup_and_subst_obj(s, e); } else if (dflt_target) - obj->headtarget = strdup(dflt_target); + obj->headtarget = gv_strdup(dflt_target); } if (flags & GVRENDER_DOES_TOOLTIPS) { @@ -2611,7 +2611,7 @@ static void emit_begin_edge(GVJ_t * job, edge_t * e, char** styles) obj->explicit_tooltip = true; } else if (obj->label) - obj->tooltip = strdup(obj->label); + obj->tooltip = gv_strdup(obj->label); if ((s = agget(e, "labeltooltip")) && s[0]) { char* tooltip = preprocessTooltip (s, e); @@ -2620,7 +2620,7 @@ static void emit_begin_edge(GVJ_t * job, edge_t * e, char** styles) obj->explicit_labeltooltip = true; } else if (obj->label) - obj->labeltooltip = strdup(obj->label); + obj->labeltooltip = gv_strdup(obj->label); if ((s = agget(e, "tailtooltip")) && s[0]) { char* tooltip = preprocessTooltip (s, e); @@ -2629,7 +2629,7 @@ static void emit_begin_edge(GVJ_t * job, edge_t * e, char** styles) obj->explicit_tailtooltip = true; } else if (obj->taillabel) - obj->tailtooltip = strdup(obj->taillabel); + obj->tailtooltip = gv_strdup(obj->taillabel); if ((s = agget(e, "headtooltip")) && s[0]) { char* tooltip = preprocessTooltip (s, e); @@ -2638,7 +2638,7 @@ static void emit_begin_edge(GVJ_t * job, edge_t * e, char** styles) obj->explicit_headtooltip = true; } else if (obj->headlabel) - obj->headtooltip = strdup(obj->headlabel); + obj->headtooltip = gv_strdup(obj->headlabel); } free (dflt_url); -- 2.40.0