summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2016-01-11 10:07:48 +0100
committerMarcus Meissner <marcus@jet.franken.de>2016-01-13 09:22:13 +0100
commit9bd3ec74f3c4b412d4de2696d7fba6e28e626f3a (patch)
treeb8645277aa8c0aa97f7b6b16f68d7c64cf622ad4
parent1e6727a597aa0f92fcda0a508d0075353280b9b9 (diff)
downloadlibgphoto2-9bd3ec74f3c4b412d4de2696d7fba6e28e626f3a.tar.gz
avoid memory leak in vcamera
-rw-r--r--libgphoto2_port/vusb/vcamera.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libgphoto2_port/vusb/vcamera.c b/libgphoto2_port/vusb/vcamera.c
index 580363a23..385f7f0b7 100644
--- a/libgphoto2_port/vusb/vcamera.c
+++ b/libgphoto2_port/vusb/vcamera.c
@@ -1415,7 +1415,8 @@ ptp_vusb_write(vcamera *cam, ptpcontainer *ptp) {
break;
}
case 1: {/* remove 1 image from directory */
- struct ptp_dirent **pcur;
+ struct ptp_dirent **pcur, *cur;
+
pcur = &first_dirent;
while (*pcur) {
if (strstr ((*pcur)->name, ".jpg") || strstr ((*pcur)->name, ".JPG"))
@@ -1428,7 +1429,11 @@ ptp_vusb_write(vcamera *cam, ptpcontainer *ptp) {
return 1;
}
ptp_inject_interrupt (cam, timeout, 0x4003, 1, (*pcur)->id, cam->seqnr); /* objectremoved */
+ cur = *pcur;
*pcur = (*pcur)->next;
+ free (cur->name);
+ free (cur->fsname);
+ free (cur);
ptp_response (cam, PTP_RC_OK, 0);
break;
}