libavformat/rtmpproto.c:413: error: Null Dereference
  pointer `sha` last assigned on line 401 could be null and is dereferenced by call to `av_sha_init()` at line 413, column 5.

libavformat/rtmpproto.c:394:1: start of procedure rtmp_calc_digest()
392.  * @param dst    buffer where calculated digest will be stored (32 bytes)
393.  */
394. static void rtmp_calc_digest(const uint8_t *src, int len, int gap,
     ^
395.                              const uint8_t *key, int keylen, uint8_t *dst)
396. {

libavformat/rtmpproto.c:398:5: 
396. {
397.     struct AVSHA *sha;
398.     uint8_t hmac_buf[64+32] = {0};
         ^
399.     int i;
400. 

libavformat/rtmpproto.c:401:5: 
399.     int i;
400. 
401.     sha = av_mallocz(av_sha_size);
         ^
402. 
403.     if (keylen < 64) {

libavutil/mem.c:154:1: start of procedure av_mallocz()
  152. }
  153. 
  154. void *av_mallocz(size_t size)
       ^
  155. {
  156.     void *ptr = av_malloc(size);

libavutil/mem.c:156:5: 
  154. void *av_mallocz(size_t size)
  155. {
  156.     void *ptr = av_malloc(size);
           ^
  157.     if (ptr)
  158.         memset(ptr, 0, size);

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

libavutil/mem.c:66:5: 
    64. void *av_malloc(size_t 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-32) )
               ^
    73.         return NULL;
    74. 

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

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

libavutil/mem.c:157:9: Taking false branch
  155. {
  156.     void *ptr = av_malloc(size);
  157.     if (ptr)
               ^
  158.         memset(ptr, 0, size);
  159.     return ptr;

libavutil/mem.c:159:5: 
  157.     if (ptr)
  158.         memset(ptr, 0, size);
  159.     return ptr;
           ^
  160. }
  161. 

libavutil/mem.c:160:1: return from a call to av_mallocz
  158.         memset(ptr, 0, size);
  159.     return ptr;
  160. }
       ^
  161. 
  162. char *av_strdup(const char *s)

libavformat/rtmpproto.c:403:9: Taking true branch
401.     sha = av_mallocz(av_sha_size);
402. 
403.     if (keylen < 64) {
             ^
404.         memcpy(hmac_buf, key, keylen);
405.     } else {

libavformat/rtmpproto.c:404:9: 
402. 
403.     if (keylen < 64) {
404.         memcpy(hmac_buf, key, keylen);
             ^
405.     } else {
406.         av_sha_init(sha, 256);

libavformat/rtmpproto.c:410:10: 
408.         av_sha_final(sha, hmac_buf);
409.     }
410.     for (i = 0; i < 64; i++)
              ^
411.         hmac_buf[i] ^= HMAC_IPAD_VAL;
412. 

libavformat/rtmpproto.c:410:17: Loop condition is true. Entering loop body
408.         av_sha_final(sha, hmac_buf);
409.     }
410.     for (i = 0; i < 64; i++)
                     ^
411.         hmac_buf[i] ^= HMAC_IPAD_VAL;
412. 

libavformat/rtmpproto.c:411:9: 
409.     }
410.     for (i = 0; i < 64; i++)
411.         hmac_buf[i] ^= HMAC_IPAD_VAL;
             ^
412. 
413.     av_sha_init(sha, 256);

libavformat/rtmpproto.c:410:25: 
408.         av_sha_final(sha, hmac_buf);
409.     }
410.     for (i = 0; i < 64; i++)
                             ^
411.         hmac_buf[i] ^= HMAC_IPAD_VAL;
412. 

libavformat/rtmpproto.c:410:17: Loop condition is false. Leaving loop
408.         av_sha_final(sha, hmac_buf);
409.     }
410.     for (i = 0; i < 64; i++)
                     ^
411.         hmac_buf[i] ^= HMAC_IPAD_VAL;
412. 

libavformat/rtmpproto.c:413:5: 
411.         hmac_buf[i] ^= HMAC_IPAD_VAL;
412. 
413.     av_sha_init(sha, 256);
         ^
414.     av_sha_update(sha, hmac_buf, 64);
415.     if (gap <= 0) {

libavutil/sha.c:246:1: start of procedure av_sha_init()
  244. 
  245. 
  246. int av_sha_init(AVSHA* ctx, int bits)
       ^
  247. {
  248.     ctx->digest_len = bits >> 5;

libavutil/sha.c:248:5: 
  246. int av_sha_init(AVSHA* ctx, int bits)
  247. {
  248.     ctx->digest_len = bits >> 5;
           ^
  249.     switch (bits) {
  250.     case 160: // SHA-1
