r1306 - trunk/src/target/u-boot/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Fri Mar 9 16:46:12 CET 2007


Author: werner
Date: 2007-03-09 16:45:53 +0100 (Fri, 09 Mar 2007)
New Revision: 1306

Modified:
   trunk/src/target/u-boot/patches/uboot-dfu.patch
Log:
drivers/usbdfu.c (handle_dnload): free stale dynamically allocated buffer 
  before starting new download (plugs memory leak after failed downloads)
drivers/usbdfu.c (dfu_init_strings): corrected partition name creation logic



Modified: trunk/src/target/u-boot/patches/uboot-dfu.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-dfu.patch	2007-03-09 15:40:30 UTC (rev 1305)
+++ trunk/src/target/u-boot/patches/uboot-dfu.patch	2007-03-09 15:45:53 UTC (rev 1306)
@@ -99,7 +99,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/drivers/usbdfu.c
-@@ -0,0 +1,1007 @@
+@@ -0,0 +1,1014 @@
 +/*
 + * (C) 2007 by OpenMoko, Inc.
 + * Author: Harald Welte <laforge at openmoko.org>
@@ -415,6 +415,11 @@
 +		return RET_STALL;
 +	}
 +
++	if (first && ds->buf && ds->buf != ds->_buf && ds->buf != LOAD_ADDR) {
++		free(ds->buf);
++		ds->buf = ds->_buf;
++	}
++
 +	switch (dev->alternate) {
 +	case 0:
 +		if (first) {
@@ -1009,13 +1014,15 @@
 +			strdesc = create_usbstring(CONFIG_DFU_ALT0_STR);
 +		} else {
 +			struct part_info *part = get_partition_nand(i-1);
-+			if (!part) {
-+				part = create_usbstring("undefined partition");
-+				if (!part)
-+					continue;
-+			}
-+			strdesc = create_usbstring(part->name);
++
++			if (part)
++				strdesc = create_usbstring(part->name);
++			else
++				strdesc =
++				    create_usbstring("undefined partition");
 +		}
++		if (!strdesc)
++			continue;
 +		usb_strings[STR_COUNT+i+1] = strdesc;
 +	}
 +}





More information about the commitlog mailing list