libavformat/rtmpproto.c:1861: error: Memory Leak
  memory dynamically allocated to `spkt.data` by call to `ff_rtmp_packet_create()` at line 1845, column 16 is not reachable after line 1861, column 1.

libavformat/rtmpproto.c:1837:1: start of procedure write_begin()
1835. }
1836. 
1837. static int write_begin(URLContext *s)
      ^
1838. {
1839.     RTMPContext *rt = s->priv_data;

libavformat/rtmpproto.c:1839:5: 
1837. static int write_begin(URLContext *s)
1838. {
1839.     RTMPContext *rt = s->priv_data;
          ^
1840.     PutByteContext pbc;
1841.     RTMPPacket spkt = { 0 };

libavformat/rtmpproto.c:1841:5: 
1839.     RTMPContext *rt = s->priv_data;
1840.     PutByteContext pbc;
1841.     RTMPPacket spkt = { 0 };
          ^
1842.     int ret;
1843. 

libavformat/rtmpproto.c:1845:9: 
1843. 
1844.     // Send Stream Begin 1
1845.     if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL,
              ^
1846.                                      RTMP_PT_PING, 0, 6)) < 0) {
1847.         av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");

libavformat/rtmppkt.c:394:1: start of procedure ff_rtmp_packet_create()
  392. }
  393. 
  394. int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
       ^
  395.                           int timestamp, int size)
  396. {

libavformat/rtmppkt.c:397:9: Taking true branch
  395.                           int timestamp, int size)
  396. {
  397.     if (size) {
               ^
  398.         pkt->data = av_realloc(NULL, size);
  399.         if (!pkt->data)

libavformat/rtmppkt.c:398:9: 
  396. {
  397.     if (size) {
  398.         pkt->data = av_realloc(NULL, size);
               ^
  399.         if (!pkt->data)
  400.             return AVERROR(ENOMEM);

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:9: Taking false branch
    122. 
    123.     /* let's disallow possibly ambiguous cases */
    124.     if (size > (INT_MAX - 16))
                 ^
    125.         return NULL;
    126. 

libavutil/mem.c:136:5: 
    134.     return _aligned_realloc(ptr, size, 32);
    135. #else
    136.     return realloc(ptr, size);
             ^
    137. #endif
    138. }

libavutil/mem.c:138:1: return from a call to av_realloc
    136.     return realloc(ptr, size);
    137. #endif
    138. }
         ^
    139. 
    140. int av_reallocp(void *ptr, size_t size)

libavformat/rtmppkt.c:399:14: Taking false branch
  397.     if (size) {
  398.         pkt->data = av_realloc(NULL, size);
  399.         if (!pkt->data)
                    ^
  400.             return AVERROR(ENOMEM);
  401.     }

libavformat/rtmppkt.c:402:5: 
  400.             return AVERROR(ENOMEM);
  401.     }
  402.     pkt->size       = size;
           ^
  403.     pkt->channel_id = channel_id;
  404.     pkt->type       = type;

libavformat/rtmppkt.c:403:5: 
  401.     }
  402.     pkt->size       = size;
  403.     pkt->channel_id = channel_id;
           ^
  404.     pkt->type       = type;
  405.     pkt->timestamp  = timestamp;

libavformat/rtmppkt.c:404:5: 
  402.     pkt->size       = size;
  403.     pkt->channel_id = channel_id;
  404.     pkt->type       = type;
           ^
  405.     pkt->timestamp  = timestamp;
  406.     pkt->extra      = 0;

libavformat/rtmppkt.c:405:5: 
  403.     pkt->channel_id = channel_id;
  404.     pkt->type       = type;
  405.     pkt->timestamp  = timestamp;
           ^
  406.     pkt->extra      = 0;
  407.     pkt->ts_field   = 0;

libavformat/rtmppkt.c:406:5: 
  404.     pkt->type       = type;
  405.     pkt->timestamp  = timestamp;
  406.     pkt->extra      = 0;
           ^
  407.     pkt->ts_field   = 0;
  408. 

libavformat/rtmppkt.c:407:5: 
  405.     pkt->timestamp  = timestamp;
  406.     pkt->extra      = 0;
  407.     pkt->ts_field   = 0;
           ^
  408. 
  409.     return 0;

libavformat/rtmppkt.c:409:5: 
  407.     pkt->ts_field   = 0;
  408. 
  409.     return 0;
           ^
  410. }
  411. 

libavformat/rtmppkt.c:410:1: return from a call to ff_rtmp_packet_create
  408. 
  409.     return 0;
  410. }
       ^
  411. 
  412. void ff_rtmp_packet_destroy(RTMPPacket *pkt)

libavformat/rtmpproto.c:1845:9: Taking false branch
1843. 
1844.     // Send Stream Begin 1
1845.     if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL,
              ^
1846.                                      RTMP_PT_PING, 0, 6)) < 0) {
1847.         av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");

libavformat/rtmpproto.c:1851:5: 
1849.     }
1850. 
1851.     bytestream2_init_writer(&pbc, spkt.data, spkt.size);
          ^
1852.     bytestream2_put_be16(&pbc, 0);          // 0 -> Stream Begin
1853.     bytestream2_put_be32(&pbc, rt->nb_streamid);

libavcodec/bytestream.h:139:1: start of procedure bytestream2_init_writer()
  137. }
  138. 
  139. static av_always_inline void bytestream2_init_writer(PutByteContext *p,
       ^
  140.                                                      uint8_t *buf,
  141.                                                      int buf_size)

libavcodec/bytestream.h:143:5: 
  141.                                                      int buf_size)
  142. {
  143.     p->buffer       = buf;
           ^
  144.     p->buffer_start = buf;
  145.     p->buffer_end   = buf + buf_size;

libavcodec/bytestream.h:144:5: 
  142. {
  143.     p->buffer       = buf;
  144.     p->buffer_start = buf;
           ^
  145.     p->buffer_end   = buf + buf_size;
  146.     p->eof          = 0;

libavcodec/bytestream.h:145:5: 
  143.     p->buffer       = buf;
  144.     p->buffer_start = buf;
  145.     p->buffer_end   = buf + buf_size;
           ^
  146.     p->eof          = 0;
  147. }

libavcodec/bytestream.h:146:5: 
  144.     p->buffer_start = buf;
  145.     p->buffer_end   = buf + buf_size;
  146.     p->eof          = 0;
           ^
  147. }
  148. 

libavcodec/bytestream.h:147:1: return from a call to bytestream2_init_writer
  145.     p->buffer_end   = buf + buf_size;
  146.     p->eof          = 0;
  147. }
       ^
  148. 
  149. static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)

libavformat/rtmpproto.c:1852:5: 
1850. 
1851.     bytestream2_init_writer(&pbc, spkt.data, spkt.size);
1852.     bytestream2_put_be16(&pbc, 0);          // 0 -> Stream Begin
          ^
1853.     bytestream2_put_be32(&pbc, rt->nb_streamid);
1854. 

libavcodec/bytestream.h:91:1: start of procedure bytestream2_put_be16()
  89. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
  90. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
  91. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
      ^
  92. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
  93. 

libavcodec/bytestream.h:91:1: Taking true branch
  89. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
  90. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
  91. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
      ^
  92. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
  93. 

libavcodec/bytestream.h:91:1: Taking true branch
  89. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
  90. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
  91. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
      ^
  92. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
  93. 

libavutil/ppc/intreadwrite.h:68:1: start of procedure av_write_bswap16()
    66. }
    67. 
    68. static av_always_inline void av_write_bswap16(void *p, uint16_t v)
        ^
    69. {
    70.     __asm__ ("sthbrx  %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v));

libavutil/ppc/intreadwrite.h:70:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
    68. static av_always_inline void av_write_bswap16(void *p, uint16_t v)
    69. {
    70.     __asm__ ("sthbrx  %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v));
            ^
    71. }
    72. 

libavutil/ppc/intreadwrite.h:71:1: return from a call to av_write_bswap16
    69. {
    70.     __asm__ ("sthbrx  %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v));
    71. }
        ^
    72. 
    73. static av_always_inline uint32_t av_read_bswap32(const void *p)

libavcodec/bytestream.h:91:1: return from a call to bytestream2_put_be16
  89. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
  90. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
  91. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
      ^
  92. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
  93. 

libavformat/rtmpproto.c:1853:5: 
1851.     bytestream2_init_writer(&pbc, spkt.data, spkt.size);
1852.     bytestream2_put_be16(&pbc, 0);          // 0 -> Stream Begin
1853.     bytestream2_put_be32(&pbc, rt->nb_streamid);
          ^
1854. 
1855.     ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,

libavcodec/bytestream.h:89:1: start of procedure bytestream2_put_be32()
  87. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16)
  88. DEF(uint64_t,     be64, 8, AV_RB64, AV_WB64)
  89. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
      ^
  90. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
  91. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)

libavcodec/bytestream.h:89:1: Taking true branch
  87. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16)
  88. DEF(uint64_t,     be64, 8, AV_RB64, AV_WB64)
  89. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
      ^
  90. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
  91. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)

libavcodec/bytestream.h:89:1: Taking true branch
  87. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16)
  88. DEF(uint64_t,     be64, 8, AV_RB64, AV_WB64)
  89. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
      ^
  90. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
  91. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)

libavutil/ppc/intreadwrite.h:80:1: start of procedure av_write_bswap32()
    78. }
    79. 
    80. static av_always_inline void av_write_bswap32(void *p, uint32_t v)
        ^
    81. {
    82.     __asm__ ("stwbrx  %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v));

libavutil/ppc/intreadwrite.h:82:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
    80. static av_always_inline void av_write_bswap32(void *p, uint32_t v)
    81. {
    82.     __asm__ ("stwbrx  %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v));
            ^
    83. }
    84. 

libavutil/ppc/intreadwrite.h:83:1: return from a call to av_write_bswap32
    81. {
    82.     __asm__ ("stwbrx  %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v));
    83. }
        ^
    84. 
    85. #if HAVE_LDBRX

libavcodec/bytestream.h:89:1: return from a call to bytestream2_put_be32
  87. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16)
  88. DEF(uint64_t,     be64, 8, AV_RB64, AV_WB64)
  89. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)
      ^
  90. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
  91. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)

libavformat/rtmpproto.c:1855:5: Skipping ff_rtmp_packet_write(): empty list of specs
1853.     bytestream2_put_be32(&pbc, rt->nb_streamid);
1854. 
1855.     ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,
          ^
1856.                                &rt->prev_pkt[1], &rt->nb_prev_pkt[1]);
1857. 

libavformat/rtmpproto.c:1858:5: 
1856.                                &rt->prev_pkt[1], &rt->nb_prev_pkt[1]);
1857. 
1858.     ff_rtmp_packet_destroy(&spkt);
          ^
1859. 
1860.     return ret;

libavformat/rtmppkt.c:412:1: start of procedure ff_rtmp_packet_destroy()
  410. }
  411. 
  412. void ff_rtmp_packet_destroy(RTMPPacket *pkt)
       ^
  413. {
  414.     if (!pkt)

libavformat/rtmppkt.c:414:10: Taking false branch
  412. void ff_rtmp_packet_destroy(RTMPPacket *pkt)
  413. {
  414.     if (!pkt)
                ^
  415.         return;
  416.     av_freep(&pkt->data);

libavformat/rtmppkt.c:416:5: 
  414.     if (!pkt)
  415.         return;
  416.     av_freep(&pkt->data);
           ^
  417.     pkt->size = 0;
  418. }

libavutil/mem.c:198:1: start of procedure av_freep()
    196. }
    197. 
    198. void av_freep(void *arg)
         ^
    199. {
    200.     void **ptr = (void **)arg;

libavutil/mem.c:200:5: 
    198. void av_freep(void *arg)
    199. {
    200.     void **ptr = (void **)arg;
             ^
    201.     av_free(*ptr);
    202.     *ptr = NULL;

libavutil/mem.c:201:5: 
    199. {
    200.     void **ptr = (void **)arg;
    201.     av_free(*ptr);
             ^
    202.     *ptr = NULL;
    203. }

libavutil/mem.c:186:1: start of procedure av_free()
      184. }
      185. 
      186. void av_free(void *ptr)
           ^
      187. {
      188. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:194:5: 
      192.     _aligned_free(ptr);
      193. #else
      194.     free(ptr);
               ^
      195. #endif
      196. }

libavutil/mem.c:196:1: return from a call to av_free
      194.     free(ptr);
      195. #endif
      196. }
           ^
      197. 
      198. void av_freep(void *arg)

libavutil/mem.c:202:5: 
    200.     void **ptr = (void **)arg;
    201.     av_free(*ptr);
    202.     *ptr = NULL;
             ^
    203. }
    204. 

libavutil/mem.c:203:1: return from a call to av_freep
    201.     av_free(*ptr);
    202.     *ptr = NULL;
    203. }
         ^
    204. 
    205. void *av_mallocz(size_t size)

libavformat/rtmppkt.c:417:5: 
  415.         return;
  416.     av_freep(&pkt->data);
  417.     pkt->size = 0;
           ^
  418. }
  419. 

libavformat/rtmppkt.c:418:1: return from a call to ff_rtmp_packet_destroy
  416.     av_freep(&pkt->data);
  417.     pkt->size = 0;
  418. }
       ^
  419. 
  420. int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end)

libavformat/rtmpproto.c:1860:5: 
1858.     ff_rtmp_packet_destroy(&spkt);
1859. 
1860.     return ret;
          ^
1861. }
1862. 

libavformat/rtmpproto.c:1861:1: return from a call to write_begin
1859. 
1860.     return ret;
1861. }
      ^
1862. 
1863. static int write_status(URLContext *s, RTMPPacket *pkt,

static int write_begin(URLContext *s)
{
    RTMPContext *rt = s->priv_data;
    PutByteContext pbc;
    RTMPPacket spkt = { 0 };
    int ret;
    if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL,
                                     RTMP_PT_PING, 0, 6)) < 0) {
        av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");
        return ret;
    }
    bytestream2_init_writer(&pbc, spkt.data, spkt.size);
    bytestream2_put_be16(&pbc, 0);
    bytestream2_put_be32(&pbc, rt->nb_streamid);
    ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,
                               &rt->prev_pkt[1], &rt->nb_prev_pkt[1]);
    ff_rtmp_packet_destroy(&spkt);
    return ret;
}
['static int write_begin(URLContext *s)\n{\n    RTMPContext *rt = s->priv_data;\n    PutByteContext pbc;\n    RTMPPacket spkt = { 0 };\n    int ret;\n    if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL,\n                                     RTMP_PT_PING, 0, 6)) < 0) {\n        av_log(s, AV_LOG_ERROR, "Unable to create response packet\\n");\n        return ret;\n    }\n    bytestream2_init_writer(&pbc, spkt.data, spkt.size);\n    bytestream2_put_be16(&pbc, 0);\n    bytestream2_put_be32(&pbc, rt->nb_streamid);\n    ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,\n                               &rt->prev_pkt[1], &rt->nb_prev_pkt[1]);\n    ff_rtmp_packet_destroy(&spkt);\n    return ret;\n}', 'int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,\n                          int timestamp, int size)\n{\n    if (size) {\n        pkt->data = av_realloc(NULL, size);\n        if (!pkt->data)\n            return AVERROR(ENOMEM);\n    }\n    pkt->size       = size;\n    pkt->channel_id = channel_id;\n    pkt->type       = type;\n    pkt->timestamp  = timestamp;\n    pkt->extra      = 0;\n    pkt->ts_field   = 0;\n    return 0;\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)\n        return av_malloc(size);\n    diff = ((char *)ptr)[-1];\n    return (char *)realloc((char *)ptr - diff, size + diff) + diff;\n#elif HAVE_ALIGNED_MALLOC\n    return _aligned_realloc(ptr, size, 32);\n#else\n    return realloc(ptr, size);\n#endif\n}', 'static av_always_inline void bytestream2_init_writer(PutByteContext *p,\n                                                     uint8_t *buf,\n                                                     int buf_size)\n{\n    p->buffer       = buf;\n    p->buffer_start = buf;\n    p->buffer_end   = buf + buf_size;\n    p->eof          = 0;\n}', 'DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)', 'DEF(unsigned int, be32, 4, AV_RB32, AV_WB32)', 'void ff_rtmp_packet_destroy(RTMPPacket *pkt)\n{\n    if (!pkt)\n        return;\n    av_freep(&pkt->data);\n    pkt->size = 0;\n}', 'void av_freep(void *arg)\n{\n    void **ptr = (void **)arg;\n    av_free(*ptr);\n    *ptr = NULL;\n}', 'void av_free(void *ptr)\n{\n#if CONFIG_MEMALIGN_HACK\n    if (ptr)\n        free((char *)ptr - ((char *)ptr)[-1]);\n#elif HAVE_ALIGNED_MALLOC\n    _aligned_free(ptr);\n#else\n    free(ptr);\n#endif\n}']