When the local variables in the function `convert_edge_labels_to_nodes` in
lib/spare/DotIO.c are initialized, the pointer `g` is dereferenced. But a
the check that tests if `g` is NULL happens after this initialization. The
fix is placing the `if (!g) return NULL` as the first line of the
function, so dereferencing only occurs if the pointer is not NULL.
Agraph_t *convert_edge_labels_to_nodes(Agraph_t* g){
+ if (!g) return NULL;
+
Agnode_t *n, *newnode;
Agraph_t *dg;
dg = agopen("test", g->desc, 0);
- if (!g) return NULL;
nnodes = agnnodes (g);
nedges = agnedges (g);