[PATCH 09/10] wcap: Plug memory leak in wcap_decoder_create()

Martin Olsson martin at minimum.se
Sat Jul 7 18:03:46 PDT 2012


---
 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 425ccff..3dc7e6d 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;
-- 
1.7.9.5



More information about the wayland-devel mailing list