Menu

#8 missing calls to close

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.4

For source code file dvbstream-cvs/mpegtools/ctools.c,
around line 2100 is the source code for the
function split_mpg.

I notice the following code

if ( (fdin = open(name, O_RDONLY|O_LARGEFILE)) < 0){

and

if ( (fdout = open(new_name,O_WRONLY|O_CREAT|O_TRUNC
|O_LARGEFILE,
S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|
S_IROTH|S_IWOTH)) < 0){

but no matching call to close for fdin or fdout. This looks like a resource
leak to me. Same file, different function cut_mpg, same problem,
same two local variables fdin, fdout.

Suggest code rework.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB