Menu

#9 memory leak

open
nobody
None
5
2009-10-23
2009-10-23
No

We've received the following report from a reporter:
---
I just had a look at factory package dvbstream-0.6-139.10
source code file dvbstream-cvs/mpegtools/ctools.c
function read_pes

I notice the following code

buf = (u8 *) malloc(p->length);
if((neof = read(f,buf,p->length))< p->length) return -1;

so if the return is taken, then buf is a memory leak.
Suggest new code

buf = (u8 *) malloc(p->length);
if((neof = read(f,buf,p->length))< p->length)
{
free( buf);
return -1;
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB