From 0310c50d0995ec97d7ff2fc2d07c6ea09a05ad21 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Wed, 19 Jan 2022 14:12:04 +0100 Subject: [PATCH] free objectinfo only if we got and objectinfo (OK reply) , fixes https://github.com/gphoto/gphoto2/issues/480 --- camlibs/ptp2/library.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 */