Free used memory.
diff --git a/ChangeLog b/ChangeLog
index eac8205..54991a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,8 @@
* src/ptp-pack.c: dito.
* src/libmtp.c: make changes necessary to handle
the new iconv(3) code in ptp-pack.c. People will have to
- use recent stdlibc, glibc or libiconv.
+ use recent stdlibc, glibc or libiconv. Also call new memory
+ clean-up functions.
2007-01-24 Ted Bullock <tbullock@canada.com>
diff --git a/src/libmtp.c b/src/libmtp.c
index f09c56b..a92e18f 100644
--- a/src/libmtp.c
+++ b/src/libmtp.c
@@ -726,11 +726,7 @@
// Then close it again.
error_handler:
close_device(ptp_usb, params, interface_number);
- // TODO: libgphoto2 does not seem to be able to free the deviceinfo
- // ptp_free_deviceinfo(¶ms->deviceinfo);
- if (params->handles.Handler != NULL) {
- free(params->handles.Handler);
- }
+ ptp_free_params(params);
return NULL;
}
@@ -744,18 +740,12 @@
PTP_USB *ptp_usb = (PTP_USB*) device->usbinfo;
close_device(ptp_usb, params, device->interface_number);
- // Free the device info and any handler
- // TODO: libgphoto2 does not seem to be able to free the deviceinfo
- // ptp_free_deviceinfo(¶ms->deviceinfo);
- if (params->handles.Handler != NULL) {
- free(params->handles.Handler);
- params->handles.Handler = NULL;
- }
// Clear error stack
LIBMTP_Clear_Errorstack(device);
// Free iconv() converters...
iconv_close(params->cd_locale_to_ucs2);
iconv_close(params->cd_ucs2_to_locale);
+ ptp_free_params(params);
free_storage_list(device);
free(device);
}