free objectinfo only if we got and objectinfo (OK reply) , fixes https://github.com/gphoto/gphoto2/issues/480

This commit is contained in:
Marcus Meissner
2022-01-19 14:12:04 +01:00
parent dd8ef92154
commit 0310c50d09

View File

@@ -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 */