Revision a0b468f5

View differences:

libavcodec/avpacket.c
47 47

  
48 48
int av_new_packet(AVPacket *pkt, int size)
49 49
{
50
    uint8_t *data;
51
    if((unsigned)size > (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
52
        return AVERROR(ENOMEM);
50
    uint8_t *data= NULL;
51
    if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE)
53 52
    data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
54
    if (!data)
55
        return AVERROR(ENOMEM);
53
    if (data){
56 54
    memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
55
    }else
56
        size=0;
57 57

  
58 58
    av_init_packet(pkt);
59 59
    pkt->data = data;
60 60
    pkt->size = size;
61 61
    pkt->destruct = av_destruct_packet;
62
    if(!data)
63
        return AVERROR(ENOMEM);
62 64
    return 0;
63 65
}
64 66

  

Also available in: Unified diff