Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: src/libmtp.c

Issue 12041060: libmtp: Fix some leaks in common code paths. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libmtp/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « patches/16_fix_leaks.patch ('k') | src/libusb1-glue.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * \file libmtp.c 2 * \file libmtp.c
3 * 3 *
4 * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se> 4 * Copyright (C) 2005-2011 Linus Walleij <triad@df.lth.se>
5 * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com> 5 * Copyright (C) 2005-2008 Richard A. Low <richard@wentnet.com>
6 * Copyright (C) 2007 Ted Bullock <tbullock@canada.com> 6 * Copyright (C) 2007 Ted Bullock <tbullock@canada.com>
7 * Copyright (C) 2007 Tero Saarni <tero.saarni@gmail.com> 7 * Copyright (C) 2007 Tero Saarni <tero.saarni@gmail.com>
8 * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com> 8 * Copyright (C) 2008 Florent Mertens <flomertens@gmail.com>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 while (element[i] != '.' && i < strlen(element)) 1771 while (element[i] != '.' && i < strlen(element))
1772 i++; 1772 i++;
1773 if (i > majstart && i < strlen(element)) { 1773 if (i > majstart && i < strlen(element)) {
1774 LIBMTP_device_extension_t *extension; 1774 LIBMTP_device_extension_t *extension;
1775 int major = 0; 1775 int major = 0;
1776 int minor = 0; 1776 int minor = 0;
1777 char *majorstr = strndup(element + majstart, i - majstart); 1777 char *majorstr = strndup(element + majstart, i - majstart);
1778 char *minorstr = strndup(element + i + 1, strlen(element) - i - 1); 1778 char *minorstr = strndup(element + i + 1, strlen(element) - i - 1);
1779 major = atoi(majorstr); 1779 major = atoi(majorstr);
1780 minor = atoi(minorstr); 1780 minor = atoi(minorstr);
1781 free(majorstr);
1782 free(minorstr);
1781 extension = malloc(sizeof(LIBMTP_device_extension_t)); 1783 extension = malloc(sizeof(LIBMTP_device_extension_t));
1782 extension->name = name; 1784 extension->name = name;
1783 extension->major = major; 1785 extension->major = major;
1784 extension->minor = minor; 1786 extension->minor = minor;
1785 extension->next = NULL; 1787 extension->next = NULL;
1786 if (mtpdevice->extensions == NULL) { 1788 if (mtpdevice->extensions == NULL) {
1787 mtpdevice->extensions = extension; 1789 mtpdevice->extensions = extension;
1788 } else { 1790 } else {
1789 LIBMTP_device_extension_t *tmp = mtpdevice->extensions; 1791 LIBMTP_device_extension_t *tmp = mtpdevice->extensions;
1790 while (tmp->next != NULL) 1792 while (tmp->next != NULL)
(...skipping 7153 matching lines...) Expand 10 before | Expand all | Expand 10 after
8944 * @param device the device which may have a cache to which the object should be updated. 8946 * @param device the device which may have a cache to which the object should be updated.
8945 * @param object_id the object to update. 8947 * @param object_id the object to update.
8946 */ 8948 */
8947 static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id ) 8949 static void update_metadata_cache(LIBMTP_mtpdevice_t *device, uint32_t object_id )
8948 { 8950 {
8949 PTPParams *params = (PTPParams *)device->params; 8951 PTPParams *params = (PTPParams *)device->params;
8950 8952
8951 ptp_remove_object_from_cache(params, object_id); 8953 ptp_remove_object_from_cache(params, object_id);
8952 add_object_to_cache(device, object_id); 8954 add_object_to_cache(device, object_id);
8953 } 8955 }
OLDNEW
« no previous file with comments | « patches/16_fix_leaks.patch ('k') | src/libusb1-glue.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698