libavfilter/vf_pad.c:79: error: Null Dereference
  pointer `*line[plane]` last assigned on line 78 could be null and is dereferenced by call to `memset()` at line 79, column 13.

libavfilter/vf_pad.c:36:1: start of procedure fill_line_with_color()
34. enum { RED = 0, GREEN, BLUE, ALPHA };
35. 
36. static int fill_line_with_color(uint8_t *line[4], int line_step[4], int w, uint8_t color[4],
    ^
37.                                 enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba)
38. {

libavfilter/vf_pad.c:39:5: 
37.                                 enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba)
38. {
39.     uint8_t rgba_map[4] = {0};
        ^
40.     int i;
41.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];

libavfilter/vf_pad.c:41:5: 
39.     uint8_t rgba_map[4] = {0};
40.     int i;
41.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
        ^
42.     int hsub = pix_desc->log2_chroma_w;
43. 

libavfilter/vf_pad.c:42:5: 
40.     int i;
41.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
42.     int hsub = pix_desc->log2_chroma_w;
        ^
43. 
44.     *is_packed_rgba = 1;

libavfilter/vf_pad.c:44:5: 
42.     int hsub = pix_desc->log2_chroma_w;
43. 
44.     *is_packed_rgba = 1;
        ^
45.     switch (pix_fmt) {
46.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;

libavfilter/vf_pad.c:45:5: 
43. 
44.     *is_packed_rgba = 1;
45.     switch (pix_fmt) {
        ^
46.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
47.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;

libavfilter/vf_pad.c:46:5: Switch condition is false. Skipping switch case
44.     *is_packed_rgba = 1;
45.     switch (pix_fmt) {
46.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
        ^
47.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
48.     case PIX_FMT_RGBA:

libavfilter/vf_pad.c:47:5: Switch condition is false. Skipping switch case
45.     switch (pix_fmt) {
46.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
47.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
        ^
48.     case PIX_FMT_RGBA:
49.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;

libavfilter/vf_pad.c:48:5: Switch condition is false. Skipping switch case
46.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
47.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
48.     case PIX_FMT_RGBA:
        ^
49.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
50.     case PIX_FMT_BGRA:

libavfilter/vf_pad.c:49:5: Switch condition is false. Skipping switch case
47.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
48.     case PIX_FMT_RGBA:
49.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
        ^
50.     case PIX_FMT_BGRA:
51.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;

libavfilter/vf_pad.c:50:5: Switch condition is false. Skipping switch case
48.     case PIX_FMT_RGBA:
49.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
50.     case PIX_FMT_BGRA:
        ^
51.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
52.     default:

libavfilter/vf_pad.c:51:5: Switch condition is false. Skipping switch case
49.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
50.     case PIX_FMT_BGRA:
51.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
        ^
52.     default:
53.         *is_packed_rgba = 0;

libavfilter/vf_pad.c:53:9: 
51.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
52.     default:
53.         *is_packed_rgba = 0;
            ^
54.     }
55. 

libavfilter/vf_pad.c:56:9: Taking false branch
54.     }
55. 
56.     if (*is_packed_rgba) {
            ^
57.         line_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
58.         for (i = 0; i < 4; i++)

libavfilter/vf_pad.c:67:9: 
65.         int plane;
66. 
67.         color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
            ^
68.         color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
69.         color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);

libavfilter/vf_pad.c:68:9: 
66. 
67.         color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
68.         color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
            ^
69.         color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
70.         color[ALPHA] = rgba_color[3];

libavfilter/vf_pad.c:69:9: 
67.         color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
68.         color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
69.         color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
            ^
70.         color[ALPHA] = rgba_color[3];
71. 

libavfilter/vf_pad.c:70:9: 
68.         color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
69.         color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
70.         color[ALPHA] = rgba_color[3];
            ^
71. 
72.         for (plane = 0; plane < 4; plane++) {

libavfilter/vf_pad.c:72:14: 
70.         color[ALPHA] = rgba_color[3];
71. 
72.         for (plane = 0; plane < 4; plane++) {
                 ^
73.             int line_size;
74.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;

libavfilter/vf_pad.c:72:25: Loop condition is true. Entering loop body
70.         color[ALPHA] = rgba_color[3];
71. 
72.         for (plane = 0; plane < 4; plane++) {
                            ^
73.             int line_size;
74.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;

libavfilter/vf_pad.c:74:26: Condition is false
72.         for (plane = 0; plane < 4; plane++) {
73.             int line_size;
74.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                             ^
75. 
76.             line_step[plane] = 1;

libavfilter/vf_pad.c:74:40: Condition is false
72.         for (plane = 0; plane < 4; plane++) {
73.             int line_size;
74.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                                           ^
75. 
76.             line_step[plane] = 1;

libavfilter/vf_pad.c:74:25: 
72.         for (plane = 0; plane < 4; plane++) {
73.             int line_size;
74.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                            ^
75. 
76.             line_step[plane] = 1;

libavfilter/vf_pad.c:74:13: 
72.         for (plane = 0; plane < 4; plane++) {
73.             int line_size;
74.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                ^
75. 
76.             line_step[plane] = 1;

libavfilter/vf_pad.c:76:13: 
74.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
75. 
76.             line_step[plane] = 1;
                ^
77.             line_size = (w >> hsub1) * line_step[plane];
78.             line[plane] = av_malloc(line_size);

libavfilter/vf_pad.c:77:13: 
75. 
76.             line_step[plane] = 1;
77.             line_size = (w >> hsub1) * line_step[plane];
                ^
78.             line[plane] = av_malloc(line_size);
79.             memset(line[plane], color[plane], line_size);

libavfilter/vf_pad.c:78:13: 
76.             line_step[plane] = 1;
77.             line_size = (w >> hsub1) * line_step[plane];
78.             line[plane] = av_malloc(line_size);
                ^
79.             memset(line[plane], color[plane], line_size);
80.         }

libavutil/mem.c:64:1: start of procedure av_malloc()
  62.    linker will do it automatically. */
  63. 
  64. void *av_malloc(unsigned int size)
      ^
  65. {
  66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
  64. void *av_malloc(unsigned int size)
  65. {
  66.     void *ptr = NULL;
          ^
  67. #if CONFIG_MEMALIGN_HACK
  68.     long diff;

libavutil/mem.c:72:8: Taking true branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-16) )
             ^
  73.         return NULL;
  74. 

libavutil/mem.c:73:9: 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-16) )
  73.         return NULL;
              ^
  74. 
  75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:117:1: return from a call to av_malloc
  115. #endif
  116.     return ptr;
  117. }
       ^
  118. 
  119. void *av_realloc(void *ptr, unsigned int size)

libavfilter/vf_pad.c:79:13: 
77.             line_size = (w >> hsub1) * line_step[plane];
78.             line[plane] = av_malloc(line_size);
79.             memset(line[plane], color[plane], line_size);
                ^
80.         }
81.     }
