summaryrefslogtreecommitdiff
path: root/libavcodec/avpacket.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/avpacket.c')
-rw-r--r--libavcodec/avpacket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 9218689239..fa2844d2cf 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -581,7 +581,8 @@ int av_packet_ref(AVPacket *dst, const AVPacket *src)
ret = packet_alloc(&dst->buf, src->size);
if (ret < 0)
goto fail;
- memcpy(dst->buf->data, src->data, src->size);
+ if (src->size)
+ memcpy(dst->buf->data, src->data, src->size);
dst->data = dst->buf->data;
} else {