Revision 9389b925 ffserver.c

View differences:

ffserver.c
2930 2930
                                   struct in_addr my_ip)
2931 2931
{
2932 2932
    AVFormatContext *avc;
2933
    AVStream avs[MAX_STREAMS];
2933
    AVStream *avs = NULL;
2934 2934
    int i;
2935 2935

  
2936 2936
    avc =  avformat_alloc_context();
......
2948 2948
        snprintf(avc->filename, 1024, "rtp://0.0.0.0");
2949 2949
    }
2950 2950

  
2951
#if !FF_API_MAX_STREAMS
2952
    if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
2953
        !(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams))))
2954
        goto sdp_done;
2955
#endif
2956
    if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
2957
        !(avs = av_malloc(avc->nb_streams * sizeof(*avs))))
2958
        goto sdp_done;
2959

  
2951 2960
    for(i = 0; i < stream->nb_streams; i++) {
2952 2961
        avc->streams[i] = &avs[i];
2953 2962
        avc->streams[i]->codec = stream->streams[i]->codec;
2954 2963
    }
2955 2964
    *pbuffer = av_mallocz(2048);
2956 2965
    avf_sdp_create(&avc, 1, *pbuffer, 2048);
2966

  
2967
 sdp_done:
2968
#if !FF_API_MAX_STREAMS
2969
    av_free(avc->streams);
2970
#endif
2957 2971
    av_metadata_free(&avc->metadata);
2958 2972
    av_free(avc);
2973
    av_free(avs);
2959 2974

  
2960 2975
    return strlen(*pbuffer);
2961 2976
}

Also available in: Unified diff