Fix GVariant memory allocation issues for tests