This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0d3bd0a
)
fd closes for failure paths.
author
Jarkko Hietaniemi
<jhi@iki.fi>
Wed, 7 May 2014 13:30:35 +0000
(09:30 -0400)
committer
Tony Cook
<tony@develop-help.com>
Thu, 29 May 2014 04:46:52 +0000
(14:46 +1000)
Fix for Coverity perl5 CIDs 29053, 29055, 29057: Resource leak (RESOURCE_LEAK)
leaked_handle: Handle variable fd going out of scope leaks the handle.
perlio.c
patch
|
blob
|
blame
|
history
diff --git
a/perlio.c
b/perlio.c
index
f110759
..
aa9a932
100644
(file)
--- a/
perlio.c
+++ b/
perlio.c
@@
-2661,6
+2661,7
@@
PerlIOUnix_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
}
if (!PerlIOValid(f)) {
if (!(f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg))) {
+ PerlLIO_close(fd);
return NULL;
}
}
@@
-2696,6
+2697,7
@@
PerlIOUnix_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags)
PerlIOUnix_setfd(aTHX_ f, fd, os->oflags);
return f;
}
+ PerlLIO_close(fd);
}
return NULL;
}
@@
-3050,6
+3052,7
@@
PerlIOStdio_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
}
return f;
}
+ PerlLIO_close(fd);
}
}
return NULL;