test: Correct test to handle key being returned from set

Signed-off-by: William Douglas <william.douglas@intel.com>
test: Free string after test not before

Signed-off-by: William Douglas <william.douglas@intel.com>