[FFmpeg-devel] [PATCH 1/2] webdashenc: Add failure check for av_malloc.
wm4
nfxjfg at googlemail.com
Tue Apr 14 19:44:53 CEST 2015
On Tue, 14 Apr 2015 10:29:33 -0700
Vignesh Venkatasubramanian <vigneshv at google.com> wrote:
> Add a missing failure check for av_malloc call.
>
> Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
> ---
> libavformat/webmdashenc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
> index c5347a9..c5d7158 100644
> --- a/libavformat/webmdashenc.c
> +++ b/libavformat/webmdashenc.c
> @@ -109,7 +109,7 @@ static void write_header(AVFormatContext *s)
> time_t local_time = time(NULL);
> struct tm gmt_buffer;
> struct tm *gmt = gmtime_r(&local_time, &gmt_buffer);
> - char *gmt_iso = av_malloc(21);
> + char gmt_iso[21];
> strftime(gmt_iso, 21, "%Y-%m-%dT%H:%M:%SZ", gmt);
> if (w->debug_mode) {
> av_strlcpy(gmt_iso, "", 1);
> @@ -122,7 +122,6 @@ static void write_header(AVFormatContext *s)
> w->utc_timing_url ? "urn:mpeg:dash:utc:http-iso:2014" : "urn:mpeg:dash:utc:direct:2012");
> avio_printf(s->pb, " value=\"%s\"/>\n",
> w->utc_timing_url ? w->utc_timing_url : gmt_iso);
> - av_free(gmt_iso);
> }
> }
>
Looks nice. Though now the title of the patch is wrong. I suggest:
"webdashenc: replace unchecked av_malloc with stack allocation"
More information about the ffmpeg-devel
mailing list