diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index 39fc34fc4..239215a61 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -3738,8 +3738,10 @@ enable_liveview: while (tries--) { ret = ptp_getobjectinfo (params, preview_object, &oi); - ptp_free_objectinfo(&oi); - if (ret == PTP_RC_OK) break; + if (ret == PTP_RC_OK) { + ptp_free_objectinfo(&oi); + break; + } if (ret == PTP_RC_InvalidObjectHandle) { /* 1000 x 10 tries was not enough for the S10 ... make the wait a bit longer * see https://github.com/gphoto/libgphoto2/issues/603 */