[Lcdproc] [patch] fix memleak in picolcd

Nicu Pavel npavel@ituner.com
Fri Nov 16 22:07:01 2007


--=-wKSLTRsWEsEnOBOj3Z9i
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,

I attached a small patch that fixes a memory leak in picolcd driver in 
picoLCD_get_key function.

Please apply.

Also we will have another LCD product a 20x4 character LCD but 
hardware and usb communication has changed. 
What will be the best way to integrate the new driver in lcdproc:

1. Add a new set of functions in picolcd.c  or
2. Make a new driver picolcd2.c which will work for the new device

Thanks,
Nicu Pavel.

--=-wKSLTRsWEsEnOBOj3Z9i
Content-Disposition: attachment; filename=picolcd-memleak.patch
Content-Type: text/x-patch; name=picolcd-memleak.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

diff -urN lcdproc-cvs/server/drivers/picolcd.c lcdproc-cvs-memleak-patch/server/drivers/picolcd.c
--- lcdproc-cvs/server/drivers/picolcd.c	2007-10-08 18:53:45.000000000 +0300
+++ lcdproc-cvs-memleak-patch/server/drivers/picolcd.c	2007-11-16 23:43:30.000000000 +0200
@@ -535,12 +535,13 @@
 		} else {
 			debug(RPT_DEBUG, "picolcd: get_key got non-key data or timeout");
 			/* We got IR or otherwise bad data */
+			free(keydata);
 			return NULL;
 		}
 
 	}
 
-   free(keydata);
+	free(keydata);
 
 	debug(RPT_DEBUG, "picolcd: get_key complete (%s)", keystr);
 

--=-wKSLTRsWEsEnOBOj3Z9i--