avconv.c:2744: error: Null Dereference
  pointer `o->attachments` last assigned on line 2742 could be null and is dereferenced at line 2744, column 5.

avconv.c:2740:1: start of procedure opt_attach()
2738. }
2739. 
2740. static int opt_attach(OptionsContext *o, const char *opt, const char *arg)
      ^
2741. {
2742.     o->attachments = grow_array(o->attachments, sizeof(*o->attachments),

avconv.c:2742:5: 
2740. static int opt_attach(OptionsContext *o, const char *opt, const char *arg)
2741. {
2742.     o->attachments = grow_array(o->attachments, sizeof(*o->attachments),
          ^
2743.                                 &o->nb_attachments, o->nb_attachments + 1);
2744.     o->attachments[o->nb_attachments - 1] = arg;

cmdutils.c:1056:1: start of procedure grow_array()
  1054. #endif /* CONFIG_AVFILTER */
  1055. 
  1056. void *grow_array(void *array, int elem_size, int *size, int new_size)
        ^
  1057. {
  1058.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:1058:9: Taking true branch
  1056. void *grow_array(void *array, int elem_size, int *size, int new_size)
  1057. {
  1058.     if (new_size >= INT_MAX / elem_size) {
                ^
  1059.         av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
  1060.         exit_program(1);

cmdutils.c:1059:9: Skipping av_log(): empty list of specs
  1057. {
  1058.     if (new_size >= INT_MAX / elem_size) {
  1059.         av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
                ^
  1060.         exit_program(1);
  1061.     }

cmdutils.c:1060:9: Skipping exit_program(): empty list of specs
  1058.     if (new_size >= INT_MAX / elem_size) {
  1059.         av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
  1060.         exit_program(1);
                ^
  1061.     }
  1062.     if (*size < new_size) {

cmdutils.c:1062:9: Taking true branch
  1060.         exit_program(1);
  1061.     }
  1062.     if (*size < new_size) {
                ^
  1063.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  1064.         if (!tmp) {

cmdutils.c:1063:9: 
  1061.     }
  1062.     if (*size < new_size) {
  1063.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
                ^
  1064.         if (!tmp) {
  1065.             av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");

libavutil/mem.c:117:1: start of procedure av_realloc()
    115. }
    116. 
    117. void *av_realloc(void *ptr, size_t size)
         ^
    118. {
    119. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:124:8: Taking false branch
    122. 
    123.     /* let's disallow possible ambiguous cases */
    124.     if(size > (INT_MAX-16) )
                ^
    125.         return NULL;
    126. 

libavutil/mem.c:133:5: 
    131.     return (char*)realloc((char*)ptr - diff, size + diff) + diff;
    132. #else
    133.     return realloc(ptr, size);
             ^
    134. #endif
    135. }

libavutil/mem.c:135:1: return from a call to av_realloc
    133.     return realloc(ptr, size);
    134. #endif
    135. }
         ^
    136. 
    137. void av_free(void *ptr)

cmdutils.c:1064:14: Taking true branch
  1062.     if (*size < new_size) {
  1063.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  1064.         if (!tmp) {
                     ^
  1065.             av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
  1066.             exit_program(1);

cmdutils.c:1065:13: Skipping av_log(): empty list of specs
  1063.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
  1064.         if (!tmp) {
  1065.             av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
                    ^
  1066.             exit_program(1);
  1067.         }

cmdutils.c:1066:13: Skipping exit_program(): empty list of specs
  1064.         if (!tmp) {
  1065.             av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
  1066.             exit_program(1);
                    ^
  1067.         }
  1068.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);

cmdutils.c:1068:9: 
  1066.             exit_program(1);
  1067.         }
  1068.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
                ^
  1069.         *size = new_size;
  1070.         return tmp;

cmdutils.c:1069:9: 
  1067.         }
  1068.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  1069.         *size = new_size;
                ^
  1070.         return tmp;
  1071.     }

cmdutils.c:1070:9: 
  1068.         memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
  1069.         *size = new_size;
  1070.         return tmp;
                ^
  1071.     }
  1072.     return array;

cmdutils.c:1073:1: return from a call to grow_array
  1071.     }
  1072.     return array;
  1073. }
        ^

avconv.c:2744:5: 
2742.     o->attachments = grow_array(o->attachments, sizeof(*o->attachments),
2743.                                 &o->nb_attachments, o->nb_attachments + 1);
2744.     o->attachments[o->nb_attachments - 1] = arg;
          ^
2745.     return 0;
2746. }

static int opt_attach(OptionsContext *o, const char *opt, const char *arg)
{
    o->attachments = grow_array(o->attachments, sizeof(*o->attachments),
                                &o->nb_attachments, o->nb_attachments + 1);
    o->attachments[o->nb_attachments - 1] = arg;
    return 0;
}
['static int opt_attach(OptionsContext *o, const char *opt, const char *arg)\n{\n    o->attachments = grow_array(o->attachments, sizeof(*o->attachments),\n                                &o->nb_attachments, o->nb_attachments + 1);\n    o->attachments[o->nb_attachments - 1] = arg;\n    return 0;\n}', 'void *grow_array(void *array, int elem_size, int *size, int new_size)\n{\n    if (new_size >= INT_MAX / elem_size) {\n        av_log(NULL, AV_LOG_ERROR, "Array too big.\\n");\n        exit_program(1);\n    }\n    if (*size < new_size) {\n        uint8_t *tmp = av_realloc(array, new_size*elem_size);\n        if (!tmp) {\n            av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\\n");\n            exit_program(1);\n        }\n        memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);\n        *size = new_size;\n        return tmp;\n    }\n    return array;\n}', 'void *av_realloc(void *ptr, size_t size)\n{\n#if CONFIG_MEMALIGN_HACK\n    int diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    if(!ptr) return av_malloc(size);\n    diff= ((char*)ptr)[-1];\n    return (char*)realloc((char*)ptr - diff, size + diff) + diff;\n#else\n    return realloc(ptr, size);\n#endif\n}']