summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2017-05-14 11:33:22 +0200
committerMarcus Meissner <marcus@jet.franken.de>2017-05-14 11:33:51 +0200
commit0b17eba47f72790861be4a2e7a0f54cd9e027506 (patch)
treeb3f1cb937f8f094fede0feb57100ab289ced05f9
parente70c2f52b2d3bd73df2aa16352f5e79219cf8c04 (diff)
downloadlibgphoto2-fuji.tar.gz
set_config: free device property value only when actually set.fuji
initialize it to 0 to avoid double frees fixes https://github.com/gphoto/libgphoto2/issues/167
-rw-r--r--camlibs/ptp2/config.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c
index 1967450b0..56326d572 100644
--- a/camlibs/ptp2/config.c
+++ b/camlibs/ptp2/config.c
@@ -7983,6 +7983,8 @@ _set_config (Camera *camera, const char *confname, CameraWidget *window, GPConte
PTPDevicePropDesc dpd;
memset(&dpd,0,sizeof(dpd));
+ memset(&propval,0,sizeof(propval));
+
C_PTP (ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd));
if (cursub->type != dpd.DataType) {
GP_LOG_E ("Type of property '%s' expected: 0x%04x got: 0x%04x", cursub->label, cursub->type, dpd.DataType );
@@ -8006,8 +8008,8 @@ _set_config (Camera *camera, const char *confname, CameraWidget *window, GPConte
_(cursub->label), cursub->propid, ret_ptp, _(ptp_strerror(ret_ptp, params->deviceinfo.VendorExtensionID)));
ret = translate_ptp_result (ret_ptp);
}
+ ptp_free_devicepropvalue (cursub->type, &propval);
}
- ptp_free_devicepropvalue (cursub->type, &propval);
ptp_free_devicepropdesc(&dpd);
} else {
ret = cursub->putfunc (camera, widget, NULL, NULL);