WIP MachO binutils port assisted by AI I may consider upstreaming this in the future.
0

Configure Feed

Select the types of activity you want to include in your feed.

asan: null pointer as arg 2 of memcpy

Replace xmalloc+memcpy+free with xrealloc, avoiding the asan warning
on the initial allocation where we had memcpy(p,0,0).

* cg_arcs.c (arc_add): Use xrealloc.

Alan Modra (May 1, 2025, 10:50 PM +0930) a388feed f72c4fa3

+2 -12
+2 -12
gprof/cg_arcs.c
··· 89 89 arc_add (Sym *parent, Sym *child, unsigned long count) 90 90 { 91 91 static unsigned int maxarcs = 0; 92 - Arc *arc, **newarcs; 92 + Arc *arc; 93 93 94 94 DBG (TALLYDEBUG, printf ("[arc_add] %lu arcs from %s to %s\n", 95 95 count, parent->name, child->name)); ··· 124 124 maxarcs = 1; 125 125 maxarcs *= 2; 126 126 127 - /* Allocate the new array. */ 128 - newarcs = (Arc **)xmalloc(sizeof (Arc *) * maxarcs); 129 - 130 - /* Copy the old array's contents into the new array. */ 131 - memcpy (newarcs, arcs, numarcs * sizeof (Arc *)); 132 - 133 - /* Free up the old array. */ 134 - free (arcs); 135 - 136 - /* And make the new array be the current array. */ 137 - arcs = newarcs; 127 + arcs = xrealloc (arcs, sizeof (*arcs) * maxarcs); 138 128 } 139 129 140 130 /* Place this arc in the arc array. */