wcap: Plug memory leak in wcap_decoder_create()
authorMartin Olsson <martin@minimum.se>
Sun, 8 Jul 2012 01:03:46 +0000 (03:03 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Mon, 9 Jul 2012 21:50:46 +0000 (17:50 -0400)
wcap/wcap-decode.c

index 425ccff..3dc7e6d 100644 (file)
@@ -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;