libavcodec/imgresample.c:545: error: Null Dereference
  pointer `ctx->resampling_ctx` last assigned on line 544 could be null and is dereferenced at line 545, column 9.

libavcodec/imgresample.c:523:1: start of procedure sws_getContext()
521. static const AVClass context_class = { "imgresample", context_to_name, NULL };
522. 
523. struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat,
     ^
524.                                   int dstW, int dstH, int dstFormat,
525.                                   int flags, SwsFilter *srcFilter,

libavcodec/imgresample.c:530:5: 
528.     struct SwsContext *ctx;
529. 
530.     ctx = av_malloc(sizeof(struct SwsContext));
         ^
531.     if (!ctx) {
532.         av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n");

libavutil/mem.c:47:1: start of procedure av_malloc()
  45.    linker will do it automatically. */
  46. 
  47. void *av_malloc(unsigned int size)
      ^
  48. {
  49.     void *ptr = NULL;

libavutil/mem.c:49:5: 
  47. void *av_malloc(unsigned int size)
  48. {
  49.     void *ptr = NULL;
          ^
  50. #if CONFIG_MEMALIGN_HACK
  51.     long diff;

libavutil/mem.c:55:8: Taking false branch
  53. 
  54.     /* let's disallow possible ambiguous cases */
  55.     if(size > (INT_MAX-16) )
             ^
  56.         return NULL;
  57. 

libavutil/mem.c:66:9: Taking false branch
  64.     ((char*)ptr)[-1]= diff;
  65. #elif HAVE_POSIX_MEMALIGN
  66.     if (posix_memalign(&ptr,16,size))
              ^
  67.         ptr = NULL;
  68. #elif HAVE_MEMALIGN

libavutil/mem.c:99:5: 
   97.     ptr = malloc(size);
   98. #endif
   99.     return ptr;
           ^
  100. }
  101. 

libavutil/mem.c:100:1: return from a call to av_malloc
   98. #endif
   99.     return ptr;
  100. }
       ^
  101. 
  102. void *av_realloc(void *ptr, unsigned int size)

libavcodec/imgresample.c:531:10: Taking false branch
529. 
530.     ctx = av_malloc(sizeof(struct SwsContext));
531.     if (!ctx) {
              ^
532.         av_log(NULL, AV_LOG_ERROR, "Cannot allocate a resampling context!\n");
533. 

libavcodec/imgresample.c:536:5: 
534.         return NULL;
535.     }
536.     ctx->av_class = &context_class;
         ^
537. 
538.     if ((srcH != dstH) || (srcW != dstW)) {

libavcodec/imgresample.c:538:10: Taking false branch
536.     ctx->av_class = &context_class;
537. 
538.     if ((srcH != dstH) || (srcW != dstW)) {
              ^
539.         if ((srcFormat != PIX_FMT_YUV420P) || (dstFormat != PIX_FMT_YUV420P)) {
540.             av_log(ctx, AV_LOG_INFO, "PIX_FMT_YUV420P will be used as an intermediate format for rescaling\n");

libavcodec/imgresample.c:538:28: Taking false branch
536.     ctx->av_class = &context_class;
537. 
538.     if ((srcH != dstH) || (srcW != dstW)) {
                                ^
539.         if ((srcFormat != PIX_FMT_YUV420P) || (dstFormat != PIX_FMT_YUV420P)) {
540.             av_log(ctx, AV_LOG_INFO, "PIX_FMT_YUV420P will be used as an intermediate format for rescaling\n");

libavcodec/imgresample.c:544:9: 
542.         ctx->resampling_ctx = img_resample_init(dstW, dstH, srcW, srcH);
543.     } else {
544.         ctx->resampling_ctx = av_malloc(sizeof(ImgReSampleContext));
             ^
545.         ctx->resampling_ctx->iheight = srcH;
546.         ctx->resampling_ctx->iwidth = srcW;

libavutil/mem.c:47:1: start of procedure av_malloc()
  45.    linker will do it automatically. */
  46. 
  47. void *av_malloc(unsigned int size)
      ^
  48. {
  49.     void *ptr = NULL;

libavutil/mem.c:49:5: 
  47. void *av_malloc(unsigned int size)
  48. {
  49.     void *ptr = NULL;
          ^
  50. #if CONFIG_MEMALIGN_HACK
  51.     long diff;

libavutil/mem.c:55:8: Taking false branch
  53. 
  54.     /* let's disallow possible ambiguous cases */
  55.     if(size > (INT_MAX-16) )
             ^
  56.         return NULL;
  57. 

libavutil/mem.c:66:9: Taking true branch
  64.     ((char*)ptr)[-1]= diff;
  65. #elif HAVE_POSIX_MEMALIGN
  66.     if (posix_memalign(&ptr,16,size))
              ^
  67.         ptr = NULL;
  68. #elif HAVE_MEMALIGN

libavutil/mem.c:67:9: 
  65. #elif HAVE_POSIX_MEMALIGN
  66.     if (posix_memalign(&ptr,16,size))
  67.         ptr = NULL;
              ^
  68. #elif HAVE_MEMALIGN
  69.     ptr = memalign(16,size);

libavutil/mem.c:99:5: 
   97.     ptr = malloc(size);
   98. #endif
   99.     return ptr;
           ^
  100. }
  101. 

libavutil/mem.c:100:1: return from a call to av_malloc
   98. #endif
   99.     return ptr;
  100. }
       ^
  101. 
  102. void *av_realloc(void *ptr, unsigned int size)

libavcodec/imgresample.c:545:9: 
543.     } else {
544.         ctx->resampling_ctx = av_malloc(sizeof(ImgReSampleContext));
545.         ctx->resampling_ctx->iheight = srcH;
             ^
546.         ctx->resampling_ctx->iwidth = srcW;
547.         ctx->resampling_ctx->oheight = dstH;
