[PATCH] Fix possible memory leak in dvbca.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allocated memory will never get free when read fails.
See attached patch.

Tomer
diff -r d3509d6e9499 lib/libdvbapi/dvbca.c
--- a/lib/libdvbapi/dvbca.c	Sat Aug 08 19:17:21 2009 +0200
+++ b/lib/libdvbapi/dvbca.c	Sun Jul 25 15:50:30 2010 +0300
@@ -110,8 +110,10 @@
 	if (buf == NULL)
 		return -1;
 
-	if ((size = read(fd, buf, data_length+2)) < 2)
+	if ((size = read(fd, buf, data_length+2)) < 2) {
+		free(buf);
 		return -1;
+	}
 
 	*slot = buf[0];
 	*connection_id = buf[1];

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux