Fix memory leak when assigning an owned gvariant to an unowned variable

Fixes bug 710882.