We get the oid of a reference, free the reference, then convert the oid to a string. We need to convert the oid before freeing the memory.