[FFmpeg-devel] [PATCH 1/2] webdashenc: Add failure check for av_malloc.
Vignesh Venkatasubramanian
vigneshv at google.com
Mon Apr 13 23:02:36 CEST 2015
On Mon, Apr 13, 2015 at 12:46 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Apr 13, 2015 at 12:16:31PM -0700, Vignesh Venkatasubramanian wrote:
>> Add a missing failure check for av_malloc call.
>>
>> Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
>> ---
>> libavformat/webmdashenc.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
>> index c5347a9..80266f7 100644
>> --- a/libavformat/webmdashenc.c
>> +++ b/libavformat/webmdashenc.c
>> @@ -87,7 +87,7 @@ static double get_duration(AVFormatContext *s)
>> return max / 1000;
>> }
>>
>> -static void write_header(AVFormatContext *s)
>> +static int write_header(AVFormatContext *s)
>> {
>> WebMDashMuxContext *w = s->priv_data;
>> double min_buffer_time = 1.0;
>> @@ -110,6 +110,7 @@ static void write_header(AVFormatContext *s)
>> struct tm gmt_buffer;
>> struct tm *gmt = gmtime_r(&local_time, &gmt_buffer);
>> char *gmt_iso = av_malloc(21);
>> + if (!gmt_iso) return AVERROR(ENOMEM);
>> strftime(gmt_iso, 21, "%Y-%m-%dT%H:%M:%SZ", gmt);
>> if (w->debug_mode) {
>> av_strlcpy(gmt_iso, "", 1);
>> @@ -124,6 +125,7 @@ static void write_header(AVFormatContext *s)
>> w->utc_timing_url ? w->utc_timing_url : gmt_iso);
>> av_free(gmt_iso);
>> }
>> + return 0;
>> }
>>
>> static void write_footer(AVFormatContext *s)
>> @@ -456,7 +458,7 @@ static int webm_dash_manifest_write_header(AVFormatContext *s)
>> double start = 0.0;
>> WebMDashMuxContext *w = s->priv_data;
>> parse_adaptation_sets(s);
>> - write_header(s);
>> + if (write_header(s) < 0) return -1;
>
> is it intended that this does not forward the error code from
> write_header() ?
>
no it is not. please ignore this patch. i'm reworking the error
handling in this file and will fix this along with that patch.
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> In fact, the RIAA has been known to suggest that students drop out
> of college or go to community college in order to be able to afford
> settlements. -- The RIAA
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
--
Vignesh
More information about the ffmpeg-devel
mailing list