[FFmpeg-cvslog] swscale: fix NULL checking in sws_alloc_context()
Xi Wang
git at videolan.org
Sat Jan 5 13:57:01 CET 2013
ffmpeg | branch: master | Xi Wang <xi.wang at gmail.com> | Fri Jan 4 21:15:33 2013 +0000| [f73f76fd202b310e8e1d0215b2e0cf038cd18c4a] | committer: 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: Xi Wang <xi.wang at gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f73f76fd202b310e8e1d0215b2e0cf038cd18c4a
---
libswscale/utils.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libswscale/utils.c b/libswscale/utils.c
index e5e4d60..f0a2b46 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -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;
}
More information about the ffmpeg-cvslog
mailing list