]> granicus.if.org Git - graphviz/commitdiff
gvpr compileProg: fix unchecked allocation failure
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 27 Aug 2022 22:27:54 +0000 (15:27 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 30 Aug 2022 03:01:58 +0000 (20:01 -0700)
lib/gvpr/compile.c

index 3ce2f08b30460b047f98523ae8c095a2a70bb7ed..42768a386e8ad7257f86093d9d1d786d950a37d4 100644 (file)
@@ -2485,7 +2485,7 @@ comp_prog *compileProg(parse_prog * inp, Gpr_t * state, int flags)
        comp_block* bp;
        parse_block* ibp = inp->blocks;
 
-       p->blocks = bp = newof(0, comp_block, inp->n_blocks, 0);
+       p->blocks = bp = gv_calloc(inp->n_blocks, sizeof(comp_block));
 
        for (i = 0; i < inp->n_blocks; bp++, i++) {
            useflags |= mkBlock(bp, p->prog, inp->source, ibp, i);