Re: [PATCH] Fix possible memory leak in dvbca.c
On Tue, Jul 27, 2010 at 6:28 PM, Tomer Barletz wrote: > 2010/7/25 Tomer Barletz : >> Allocated memory will never get free when read fails. >> See attached patch. >> >> Tomer >> > > Attached a better patch... :) > Ok, thanks. Will apply. Regards, Manu -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Fix possible memory leak in dvbca.c
2010/7/25 Tomer Barletz : > Allocated memory will never get free when read fails. > See attached patch. > > Tomer > Attached a better patch... :) 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 Tue Jul 27 15:56:48 2010 +0300 @@ -89,8 +89,10 @@ uint8_t *data, uint16_t data_length) { uint8_t *buf = malloc(data_length + 2); - if (buf == NULL) + if (buf == NULL) { + free(buf); return -1; + } buf[0] = slot; buf[1] = connection_id; @@ -110,8 +112,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];
Re: [PATCH] Fix possible memory leak in dvbca.c
2010/7/25 Tomer Barletz : > Allocated memory will never get free when read fails. > See attached patch. > > Tomer > Does anybody knows who's dvb-apps maintainer? -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Fix possible memory leak in dvbca.c
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];