From 9988633f5871c4dbbf6796945c528c8b468b2eed Mon Sep 17 00:00:00 2001 From: Martin Olsson Date: Sun, 8 Jul 2012 03:03:46 +0200 Subject: [PATCH] wcap: Plug memory leak in wcap_decoder_create() --- wcap/wcap-decode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wcap/wcap-decode.c b/wcap/wcap-decode.c index 425ccff1..3dc7e6d7 100644 --- a/wcap/wcap-decode.c +++ b/wcap/wcap-decode.c @@ -120,8 +120,10 @@ wcap_decoder_create(const char *filename) return NULL; decoder->fd = open(filename, O_RDONLY); - if (decoder->fd == -1) + if (decoder->fd == -1) { + free(decoder); return NULL; + } fstat(decoder->fd, &buf); decoder->size = buf.st_size;