projects
/
platform
/
upstream
/
weston.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fec723e
)
wcap: Prevent fd leak in wcap_decoder_create() fail path
author
Sergi Granell
<xerpi.g.12@gmail.com>
Wed, 29 Mar 2017 20:41:02 +0000
(22:41 +0200)
committer
Quentin Glidic
<sardemff7+git@sardemff7.net>
Thu, 30 Mar 2017 23:41:45 +0000
(
01:41
+0200)
Signed-off-by: Sergi Granell <xerpi.g.12@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
wcap/wcap-decode.c
patch
|
blob
|
history
diff --git
a/wcap/wcap-decode.c
b/wcap/wcap-decode.c
index
e3b8985
..
7e8c847
100644
(file)
--- a/
wcap/wcap-decode.c
+++ b/
wcap/wcap-decode.c
@@
-131,6
+131,7
@@
wcap_decoder_create(const char *filename)
PROT_READ, MAP_PRIVATE, decoder->fd, 0);
if (decoder->map == MAP_FAILED) {
fprintf(stderr, "mmap failed\n");
+ close(decoder->fd);
free(decoder);
return NULL;
}
@@
-146,6
+147,7
@@
wcap_decoder_create(const char *filename)
frame_size = header->width * header->height * 4;
decoder->frame = malloc(frame_size);
if (decoder->frame == NULL) {
+ close(decoder->fd);
free(decoder);
return NULL;
}