test context before accessing it

Originally committed as revision 9436 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Benoit Fouet 18 years ago
parent 9de8e6acf9
commit 5b43487d23
  1. 1
      libavcodec/imgresample.c

@ -643,6 +643,7 @@ struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat,
struct SwsContext *ctx;
ctx = av_malloc(sizeof(struct SwsContext));
if (ctx)
ctx->av_class = av_mallocz(sizeof(AVClass));
if (!ctx || !ctx->av_class) {
av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n");

Loading…
Cancel
Save