avpacket: Check buffer reference

CC: libav-stable@libav.org
Bug-Id: CID 1267889
pull/113/head^2
Vittorio Giovara 10 years ago
parent 31dc73e92a
commit fe0f4e5657
  1. 7
      libavcodec/avpacket.c

@ -365,8 +365,13 @@ int av_packet_ref(AVPacket *dst, AVPacket *src)
if (ret < 0) if (ret < 0)
goto fail; goto fail;
memcpy(dst->buf->data, src->data, src->size); memcpy(dst->buf->data, src->data, src->size);
} else } else {
dst->buf = av_buffer_ref(src->buf); dst->buf = av_buffer_ref(src->buf);
if (!dst->buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
dst->size = src->size; dst->size = src->size;
dst->data = dst->buf->data; dst->data = dst->buf->data;

Loading…
Cancel
Save