summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2022-01-19 14:12:04 +0100
committerMarcus Meissner <marcus@jet.franken.de>2022-01-19 14:12:04 +0100
commit0310c50d0995ec97d7ff2fc2d07c6ea09a05ad21 (patch)
treeaac514b5a32cdf4a2b919640026000825a90df62
parentdd8ef92154ff48f9ba82ca446b1dd96951fa307d (diff)
downloadlibgphoto2-0310c50d0995ec97d7ff2fc2d07c6ea09a05ad21.tar.gz
free objectinfo only if we got and objectinfo (OK reply) , fixes https://github.com/gphoto/gphoto2/issues/480
-rw-r--r--camlibs/ptp2/library.c6
1 files 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 */