rtmp: Don't try to do av_malloc(0)
[ffmpeg.git] / libavformat / rtmppkt.c
index 63b0628..93790eb 100644 (file)
@@ -233,9 +233,11 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
                           int timestamp, int size)
 {
 int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
                           int timestamp, int size)
 {
+    if (size) {
     pkt->data = av_malloc(size);
     if (!pkt->data)
         return AVERROR(ENOMEM);
     pkt->data = av_malloc(size);
     if (!pkt->data)
         return AVERROR(ENOMEM);
+    }
     pkt->data_size  = size;
     pkt->channel_id = channel_id;
     pkt->type       = type;
     pkt->data_size  = size;
     pkt->channel_id = channel_id;
     pkt->type       = type;