diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index bc2d7d741..992dcc4ea 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -3691,8 +3691,8 @@ enable_liveview: usleep(50*1000); continue; } - - ptp_free_objectinfo(&oi); + if (ret == PTP_RC_OK) + ptp_free_objectinfo(&oi); ret = ptp_getobject_with_size(params, preview_object, &ximage, &size); if (ret == PTP_RC_OK)