Fix memory leak in libgsm wrapper.