Signed-off-by: Sergi Granell <[email protected]>
---
 wcap/wcap-decode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/wcap/wcap-decode.c b/wcap/wcap-decode.c
index e3b8985f..7e8c8477 100644
--- 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;
        }
-- 
2.12.2

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to