mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 00:32:31 +00:00
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: Xi Wang <xi.wang@gmail.com> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
This commit is contained in:
parent
3b81bba3bc
commit
f73f76fd20
@ -844,8 +844,10 @@ SwsContext *sws_alloc_context(void)
|
|||||||
{
|
{
|
||||||
SwsContext *c = av_mallocz(sizeof(SwsContext));
|
SwsContext *c = av_mallocz(sizeof(SwsContext));
|
||||||
|
|
||||||
|
if (c) {
|
||||||
c->av_class = &sws_context_class;
|
c->av_class = &sws_context_class;
|
||||||
av_opt_set_defaults(c);
|
av_opt_set_defaults(c);
|
||||||
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user