Commit f73f76fd authored by Xi Wang's avatar Xi Wang Committed by Derek Buitenhuis

swscale: fix NULL checking in sws_alloc_context()

sws_getCachedContext() and sws_getContext() expect sws_alloc_context()
to return NULL when out of memory, as follows.

    if (!(context = sws_alloc_context()))
        return NULL;

This patch fixes sws_alloc_context() to return NULL in that case.
Signed-off-by: 's avatarXi Wang <xi.wang@gmail.com>
Signed-off-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parent 3b81bba3
......@@ -844,8 +844,10 @@ SwsContext *sws_alloc_context(void)
{
SwsContext *c = av_mallocz(sizeof(SwsContext));
c->av_class = &sws_context_class;
av_opt_set_defaults(c);
if (c) {
c->av_class = &sws_context_class;
av_opt_set_defaults(c);
}
return c;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment