diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index 8f5e2bd120..c9de93f774 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -313,9 +313,10 @@ static void destroy_context(AVFContext* ctx) static int parse_device_name(AVFormatContext *s) { AVFContext *ctx = (AVFContext*)s->priv_data; - ctx->url = av_strdup(s->url); char *save; + ctx->url = av_strdup(s->url); + if (!ctx->url) return AVERROR(ENOMEM); if (ctx->url[0] != ':') {