if a pointer to data is passed to the graph, try to free it

This allows stashing of arbitrary blocks in the graph.  If none are given, the
free call has no effect and is safe.