Add user supplied free function

Signed-off-by: Spencer Deinum <spencerdeinum@gmail.com>