libavcodec/psymodel.c:51: error: Null Dereference
  pointer `ctx->group` last assigned on line 39 could be null and is dereferenced at line 51, column 9.

libavcodec/psymodel.c:31:9: start of procedure ff_psy_init()
29. extern const FFPsyModel ff_aac_psy_model;
30. 
31. av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens,
            ^
32.                         const uint8_t **bands, const int* num_bands,
33.                         int num_groups, const uint8_t *group_map)

libavcodec/psymodel.c:35:5: 
33.                         int num_groups, const uint8_t *group_map)
34. {
35.     int i, j, k = 0;
        ^
36. 
37.     ctx->avctx = avctx;

libavcodec/psymodel.c:37:5: 
35.     int i, j, k = 0;
36. 
37.     ctx->avctx = avctx;
        ^
38.     ctx->ch        = av_mallocz(sizeof(ctx->ch[0]) * avctx->channels * 2);
39.     ctx->group     = av_mallocz(sizeof(ctx->group[0]) * num_groups);

libavcodec/psymodel.c:38:5: 
36. 
37.     ctx->avctx = avctx;
38.     ctx->ch        = av_mallocz(sizeof(ctx->ch[0]) * avctx->channels * 2);
        ^
39.     ctx->group     = av_mallocz(sizeof(ctx->group[0]) * num_groups);
40.     ctx->bands     = av_malloc (sizeof(ctx->bands[0])     * num_lens);

libavutil/mem.c:184:1: start of procedure av_mallocz()
  182. }
  183. 
  184. void *av_mallocz(size_t size)
       ^
  185. {
  186.     void *ptr = av_malloc(size);

libavutil/mem.c:186:5: 
  184. void *av_mallocz(size_t size)
  185. {
  186.     void *ptr = av_malloc(size);
           ^
  187.     if (ptr)
  188.         memset(ptr, 0, size);

libavutil/mem.c:61:1: start of procedure av_malloc()
    59.  * linker will do it automatically. */
    60. 
    61. void *av_malloc(size_t size)
        ^
    62. {
    63.     void *ptr = NULL;

libavutil/mem.c:63:5: 
    61. void *av_malloc(size_t size)
    62. {
    63.     void *ptr = NULL;
            ^
    64. #if CONFIG_MEMALIGN_HACK
    65.     long diff;

libavutil/mem.c:69:9: Taking true branch
    67. 
    68.     /* let's disallow possibly ambiguous cases */
    69.     if (size > (INT_MAX - 32) || !size)
                ^
    70.         return NULL;
    71. 

libavutil/mem.c:70:9: 
    68.     /* let's disallow possibly ambiguous cases */
    69.     if (size > (INT_MAX - 32) || !size)
    70.         return NULL;
                ^
    71. 
    72. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:114:1: return from a call to av_malloc
    112. #endif
    113.     return ptr;
    114. }
         ^
    115. 
    116. void *av_realloc(void *ptr, size_t size)

libavutil/mem.c:187:9: Taking false branch
  185. {
  186.     void *ptr = av_malloc(size);
  187.     if (ptr)
               ^
  188.         memset(ptr, 0, size);
  189.     return ptr;

libavutil/mem.c:189:5: 
  187.     if (ptr)
  188.         memset(ptr, 0, size);
  189.     return ptr;
           ^
  190. }
  191. 

libavutil/mem.c:190:1: return from a call to av_mallocz
  188.         memset(ptr, 0, size);
  189.     return ptr;
  190. }
       ^
  191. 
  192. char *av_strdup(const char *s)

libavcodec/psymodel.c:39:5: 
37.     ctx->avctx = avctx;
38.     ctx->ch        = av_mallocz(sizeof(ctx->ch[0]) * avctx->channels * 2);
39.     ctx->group     = av_mallocz(sizeof(ctx->group[0]) * num_groups);
        ^
40.     ctx->bands     = av_malloc (sizeof(ctx->bands[0])     * num_lens);
41.     ctx->num_bands = av_malloc (sizeof(ctx->num_bands[0]) * num_lens);

libavutil/mem.c:184:1: start of procedure av_mallocz()
  182. }
  183. 
  184. void *av_mallocz(size_t size)
       ^
  185. {
  186.     void *ptr = av_malloc(size);

libavutil/mem.c:186:5: 
  184. void *av_mallocz(size_t size)
  185. {
  186.     void *ptr = av_malloc(size);
           ^
  187.     if (ptr)
  188.         memset(ptr, 0, size);

libavutil/mem.c:61:1: start of procedure av_malloc()
    59.  * linker will do it automatically. */
    60. 
    61. void *av_malloc(size_t size)
        ^
    62. {
    63.     void *ptr = NULL;

libavutil/mem.c:63:5: 
    61. void *av_malloc(size_t size)
    62. {
    63.     void *ptr = NULL;
            ^
    64. #if CONFIG_MEMALIGN_HACK
    65.     long diff;

libavutil/mem.c:69:9: Taking true branch
    67. 
    68.     /* let's disallow possibly ambiguous cases */
    69.     if (size > (INT_MAX - 32) || !size)
                ^
    70.         return NULL;
    71. 

libavutil/mem.c:70:9: 
    68.     /* let's disallow possibly ambiguous cases */
    69.     if (size > (INT_MAX - 32) || !size)
    70.         return NULL;
                ^
    71. 
    72. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:114:1: return from a call to av_malloc
    112. #endif
    113.     return ptr;
    114. }
         ^
    115. 
    116. void *av_realloc(void *ptr, size_t size)

libavutil/mem.c:187:9: Taking false branch
  185. {
  186.     void *ptr = av_malloc(size);
  187.     if (ptr)
               ^
  188.         memset(ptr, 0, size);
  189.     return ptr;

libavutil/mem.c:189:5: 
  187.     if (ptr)
  188.         memset(ptr, 0, size);
  189.     return ptr;
           ^
  190. }
  191. 

libavutil/mem.c:190:1: return from a call to av_mallocz
  188.         memset(ptr, 0, size);
  189.     return ptr;
  190. }
       ^
  191. 
  192. char *av_strdup(const char *s)

libavcodec/psymodel.c:40:5: 
38.     ctx->ch        = av_mallocz(sizeof(ctx->ch[0]) * avctx->channels * 2);
39.     ctx->group     = av_mallocz(sizeof(ctx->group[0]) * num_groups);
40.     ctx->bands     = av_malloc (sizeof(ctx->bands[0])     * num_lens);
        ^
41.     ctx->num_bands = av_malloc (sizeof(ctx->num_bands[0]) * num_lens);
42.     memcpy(ctx->bands,     bands,     sizeof(ctx->bands[0])     *  num_lens);

libavutil/mem.c:61:1: start of procedure av_malloc()
  59.  * linker will do it automatically. */
  60. 
  61. void *av_malloc(size_t size)
      ^
  62. {
  63.     void *ptr = NULL;

libavutil/mem.c:63:5: 
  61. void *av_malloc(size_t size)
  62. {
  63.     void *ptr = NULL;
          ^
  64. #if CONFIG_MEMALIGN_HACK
  65.     long diff;

libavutil/mem.c:69:9: Taking false branch
  67. 
  68.     /* let's disallow possibly ambiguous cases */
  69.     if (size > (INT_MAX - 32) || !size)
              ^
  70.         return NULL;
  71. 

libavutil/mem.c:69:35: Taking false branch
  67. 
  68.     /* let's disallow possibly ambiguous cases */
  69.     if (size > (INT_MAX - 32) || !size)
                                        ^
  70.         return NULL;
  71. 

libavutil/mem.c:80:9: Taking false branch
  78.     ((char *)ptr)[-1] = diff;
  79. #elif HAVE_POSIX_MEMALIGN
  80.     if (posix_memalign(&ptr, 32, size))
              ^
  81.         ptr = NULL;
  82. #elif HAVE_ALIGNED_MALLOC

libavutil/mem.c:113:5: 
  111.     ptr = malloc(size);
  112. #endif
  113.     return ptr;
           ^
  114. }
  115. 

libavutil/mem.c:114:1: return from a call to av_malloc
  112. #endif
  113.     return ptr;
  114. }
       ^
  115. 
  116. void *av_realloc(void *ptr, size_t size)

libavcodec/psymodel.c:41:5: 
39.     ctx->group     = av_mallocz(sizeof(ctx->group[0]) * num_groups);
40.     ctx->bands     = av_malloc (sizeof(ctx->bands[0])     * num_lens);
41.     ctx->num_bands = av_malloc (sizeof(ctx->num_bands[0]) * num_lens);
        ^
42.     memcpy(ctx->bands,     bands,     sizeof(ctx->bands[0])     *  num_lens);
43.     memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) *  num_lens);

libavutil/mem.c:61:1: start of procedure av_malloc()
  59.  * linker will do it automatically. */
  60. 
  61. void *av_malloc(size_t size)
      ^
  62. {
  63.     void *ptr = NULL;

libavutil/mem.c:63:5: 
  61. void *av_malloc(size_t size)
  62. {
  63.     void *ptr = NULL;
          ^
  64. #if CONFIG_MEMALIGN_HACK
  65.     long diff;

libavutil/mem.c:69:9: Taking false branch
  67. 
  68.     /* let's disallow possibly ambiguous cases */
  69.     if (size > (INT_MAX - 32) || !size)
              ^
  70.         return NULL;
  71. 

libavutil/mem.c:69:35: Taking false branch
  67. 
  68.     /* let's disallow possibly ambiguous cases */
  69.     if (size > (INT_MAX - 32) || !size)
                                        ^
  70.         return NULL;
  71. 

libavutil/mem.c:80:9: Taking false branch
  78.     ((char *)ptr)[-1] = diff;
  79. #elif HAVE_POSIX_MEMALIGN
  80.     if (posix_memalign(&ptr, 32, size))
              ^
  81.         ptr = NULL;
  82. #elif HAVE_ALIGNED_MALLOC

libavutil/mem.c:113:5: 
  111.     ptr = malloc(size);
  112. #endif
  113.     return ptr;
           ^
  114. }
  115. 

libavutil/mem.c:114:1: return from a call to av_malloc
  112. #endif
  113.     return ptr;
  114. }
       ^
  115. 
  116. void *av_realloc(void *ptr, size_t size)

libavcodec/psymodel.c:42:5: 
40.     ctx->bands     = av_malloc (sizeof(ctx->bands[0])     * num_lens);
41.     ctx->num_bands = av_malloc (sizeof(ctx->num_bands[0]) * num_lens);
42.     memcpy(ctx->bands,     bands,     sizeof(ctx->bands[0])     *  num_lens);
        ^
43.     memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) *  num_lens);
44. 

libavcodec/psymodel.c:43:5: 
41.     ctx->num_bands = av_malloc (sizeof(ctx->num_bands[0]) * num_lens);
42.     memcpy(ctx->bands,     bands,     sizeof(ctx->bands[0])     *  num_lens);
43.     memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) *  num_lens);
        ^
44. 
45.     /* assign channels to groups (with virtual channels for coupling) */

libavcodec/psymodel.c:46:10: 
44. 
45.     /* assign channels to groups (with virtual channels for coupling) */
46.     for (i = 0; i < num_groups; i++) {
             ^
47.         /* NOTE: Add 1 to handle the AAC chan_config without modification.
48.          *       This has the side effect of allowing an array of 0s to map

libavcodec/psymodel.c:46:17: Loop condition is true. Entering loop body
44. 
45.     /* assign channels to groups (with virtual channels for coupling) */
46.     for (i = 0; i < num_groups; i++) {
                    ^
47.         /* NOTE: Add 1 to handle the AAC chan_config without modification.
48.          *       This has the side effect of allowing an array of 0s to map

libavcodec/psymodel.c:51:9: 
49.          *       to one channel per group.
50.          */
51.         ctx->group[i].num_ch = group_map[i] + 1;
            ^
52.         for (j = 0; j < ctx->group[i].num_ch * 2; j++)
53.             ctx->group[i].ch[j]  = &ctx->ch[k++];
