diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-17 11:01:16 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-17 11:01:16 +0200 |
commit | 157969321a93735d70277381b98070ababd631cf (patch) | |
tree | 86bf743d6981e4f73cdda01264c9924c0da49097 /libavformat | |
parent | d36eac698f65dc78eac7cccdecf6fdd7b058778e (diff) | |
parent | 22cc57da64bfd73f2206969486b0aa183ee76479 (diff) |
Merge commit '22cc57da64bfd73f2206969486b0aa183ee76479'
* commit '22cc57da64bfd73f2206969486b0aa183ee76479':
rtpdec: Forward the memory failure
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rtpdec.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index f39f87ff1b..c3e50d44b2 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -691,7 +691,7 @@ void ff_rtp_reset_packet_queue(RTPDemuxContext *s) s->prev_ret = 0; } -static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len) +static int enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len) { uint16_t seq = AV_RB16(buf + 2); RTPPacket **cur = &s->queue, *packet; @@ -706,7 +706,7 @@ static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len) packet = av_mallocz(sizeof(*packet)); if (!packet) - return; + return AVERROR(ENOMEM); packet->recvtime = av_gettime_relative(); packet->seq = seq; packet->len = len; @@ -714,6 +714,8 @@ static void enqueue_packet(RTPDemuxContext *s, uint8_t *buf, int len) packet->next = *cur; *cur = packet; s->queue_len++; + + return 0; } static int has_next_packet(RTPDemuxContext *s) @@ -811,7 +813,9 @@ static int rtp_parse_one_packet(RTPDemuxContext *s, AVPacket *pkt, return rv; } else { /* Still missing some packet, enqueue this one. */ - enqueue_packet(s, buf, len); + rv = enqueue_packet(s, buf, len); + if (rv < 0) + return rv; *bufptr = NULL; /* Return the first enqueued packet if the queue is full, * even if we're missing something */ |