check for non-NULL before calling pairbasicfree()