jack: Check memory allocation
authorVittorio Giovara <vittorio.giovara@gmail.com>
Wed, 3 Jun 2015 13:16:48 +0000 (14:16 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 8 Jun 2015 12:03:27 +0000 (13:03 +0100)
CC: libav-stable@libav.org
Bug-Id: CID 1292520

libavdevice/jack.c

index 5d000a3..aa9348d 100644 (file)
@@ -202,6 +202,10 @@ static int start_jack(AVFormatContext *context)
     self->filled_pkts = av_fifo_alloc(FIFO_PACKETS_NUM * sizeof(AVPacket));
     /* New packets FIFO with one extra packet for safety against underruns */
     self->new_pkts    = av_fifo_alloc((FIFO_PACKETS_NUM + 1) * sizeof(AVPacket));
+    if (!self->new_pkts) {
+        jack_client_close(self->client);
+        return AVERROR(ENOMEM);
+    }
     if ((test = supply_new_packets(self, context))) {
         jack_client_close(self->client);
         return test;