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

libavformat/rtmpproto.c:1830:1: start of procedure write_begin()
1828. }
1829. 
1830. static int write_begin(URLContext *s)
      ^
1831. {
1832.     RTMPContext *rt = s->priv_data;

libavformat/rtmpproto.c:1832:5: 
1830. static int write_begin(URLContext *s)
1831. {
1832.     RTMPContext *rt = s->priv_data;
          ^
1833.     PutByteContext pbc;
1834.     RTMPPacket spkt = { 0 };

libavformat/rtmpproto.c:1834:5: 
1832.     RTMPContext *rt = s->priv_data;
1833.     PutByteContext pbc;
1834.     RTMPPacket spkt = { 0 };
          ^
1835.     int ret;
1836. 

libavformat/rtmpproto.c:1838:9: 
1836. 
1837.     // Send Stream Begin 1
1838.     if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL,
              ^
1839.                                      RTMP_PT_USER_CONTROL, 0, 6)) < 0) {
1840.         av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");

libavformat/rtmppkt.c:409:1: start of procedure ff_rtmp_packet_create()
  407. }
  408. 
  409. int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type,
       ^
  410.                           int timestamp, int size)
  411. {

libavformat/rtmppkt.c:412:9: Taking true branch
  410.                           int timestamp, int size)
  411. {
  412.     if (size) {
               ^
  413.         pkt->data = av_realloc(NULL, size);
  414.         if (!pkt->data)

libavformat/rtmppkt.c:413:9: 
  411. {
  412.     if (size) {
  413.         pkt->data = av_realloc(NULL, size);
               ^
  414.         if (!pkt->data)
  415.             return AVERROR(ENOMEM);

libavutil/mem.c:107:1: start of procedure av_realloc()
    105. }
    106. 
    107. void *av_realloc(void *ptr, size_t size)
         ^
    108. {
    109.     /* let's disallow possibly ambiguous cases */

libavutil/mem.c:110:9: Taking false branch
    108. {
    109.     /* let's disallow possibly ambiguous cases */
    110.     if (size > (INT_MAX - 16))
                 ^
    111.         return NULL;
    112. 

libavutil/mem.c:116:5: 
    114.     return _aligned_realloc(ptr, size, 32);
    115. #else
    116.     return realloc(ptr, size);
             ^
    117. #endif
    118. }

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

libavformat/rtmppkt.c:414:14: Taking false branch
  412.     if (size) {
  413.         pkt->data = av_realloc(NULL, size);
  414.         if (!pkt->data)
                    ^
  415.             return AVERROR(ENOMEM);
  416.     }

libavformat/rtmppkt.c:417:5: 
  415.             return AVERROR(ENOMEM);
  416.     }
  417.     pkt->size       = size;
           ^
  418.     pkt->channel_id = channel_id;
  419.     pkt->type       = type;

libavformat/rtmppkt.c:418:5: 
  416.     }
  417.     pkt->size       = size;
  418.     pkt->channel_id = channel_id;
           ^
  419.     pkt->type       = type;
  420.     pkt->timestamp  = timestamp;

libavformat/rtmppkt.c:419:5: 
  417.     pkt->size       = size;
  418.     pkt->channel_id = channel_id;
  419.     pkt->type       = type;
           ^
  420.     pkt->timestamp  = timestamp;
  421.     pkt->extra      = 0;

libavformat/rtmppkt.c:420:5: 
  418.     pkt->channel_id = channel_id;
  419.     pkt->type       = type;
  420.     pkt->timestamp  = timestamp;
           ^
  421.     pkt->extra      = 0;
  422.     pkt->ts_field   = 0;

libavformat/rtmppkt.c:421:5: 
  419.     pkt->type       = type;
  420.     pkt->timestamp  = timestamp;
  421.     pkt->extra      = 0;
           ^
  422.     pkt->ts_field   = 0;
  423. 

libavformat/rtmppkt.c:422:5: 
  420.     pkt->timestamp  = timestamp;
  421.     pkt->extra      = 0;
  422.     pkt->ts_field   = 0;
           ^
  423. 
  424.     return 0;

libavformat/rtmppkt.c:424:5: 
  422.     pkt->ts_field   = 0;
  423. 
  424.     return 0;
           ^
  425. }
  426. 

libavformat/rtmppkt.c:425:1: return from a call to ff_rtmp_packet_create
  423. 
  424.     return 0;
  425. }
       ^
  426. 
  427. void ff_rtmp_packet_destroy(RTMPPacket *pkt)

libavformat/rtmpproto.c:1838:9: Taking false branch
1836. 
1837.     // Send Stream Begin 1
1838.     if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL,
              ^
1839.                                      RTMP_PT_USER_CONTROL, 0, 6)) < 0) {
1840.         av_log(s, AV_LOG_ERROR, "Unable to create response packet\n");

libavformat/rtmpproto.c:1844:5: 
1842.     }
1843. 
1844.     bytestream2_init_writer(&pbc, spkt.data, spkt.size);
          ^
1845.     bytestream2_put_be16(&pbc, 0);          // 0 -> Stream Begin
1846.     bytestream2_put_be32(&pbc, rt->nb_streamid);

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

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

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

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

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

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

libavformat/rtmpproto.c:1845:5: 
1843. 
1844.     bytestream2_init_writer(&pbc, spkt.data, spkt.size);
1845.     bytestream2_put_be16(&pbc, 0);          // 0 -> Stream Begin
          ^
1846.     bytestream2_put_be32(&pbc, rt->nb_streamid);
1847. 

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

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

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

libavutil/ppc/intreadwrite.h:54:1: start of procedure av_write_bswap16()
    52. }
    53. 
    54. static av_always_inline void av_write_bswap16(void *p, uint16_t v)
        ^
    55. {
    56.     __asm__ ("sthbrx  %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v));

libavutil/ppc/intreadwrite.h:56:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
    54. static av_always_inline void av_write_bswap16(void *p, uint16_t v)
    55. {
    56.     __asm__ ("sthbrx  %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v));
            ^
    57. }
    58. 

libavutil/ppc/intreadwrite.h:57:1: return from a call to av_write_bswap16
    55. {
    56.     __asm__ ("sthbrx  %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v));
    57. }
        ^
    58. 
    59. static av_always_inline uint32_t av_read_bswap32(const void *p)

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

libavformat/rtmpproto.c:1846:5: 
1844.     bytestream2_init_writer(&pbc, spkt.data, spkt.size);
1845.     bytestream2_put_be16(&pbc, 0);          // 0 -> Stream Begin
1846.     bytestream2_put_be32(&pbc, rt->nb_streamid);
          ^
1847. 
1848.     ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,

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

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

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

libavutil/ppc/intreadwrite.h:66:1: start of procedure av_write_bswap32()
    64. }
    65. 
    66. static av_always_inline void av_write_bswap32(void *p, uint32_t v)
        ^
    67. {
    68.     __asm__ ("stwbrx  %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v));

libavutil/ppc/intreadwrite.h:68:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found
    66. static av_always_inline void av_write_bswap32(void *p, uint32_t v)
    67. {
    68.     __asm__ ("stwbrx  %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v));
            ^
    69. }
    70. 

libavutil/ppc/intreadwrite.h:69:1: return from a call to av_write_bswap32
    67. {
    68.     __asm__ ("stwbrx  %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v));
    69. }
        ^
    70. 
    71. #if HAVE_LDBRX

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

libavformat/rtmpproto.c:1848:5: Skipping ff_rtmp_packet_write(): empty list of specs
1846.     bytestream2_put_be32(&pbc, rt->nb_streamid);
1847. 
1848.     ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size,
          ^
1849.                                &rt->prev_pkt[1], &rt->nb_prev_pkt[1]);
1850. 

libavformat/rtmpproto.c:1851:5: 
1849.                                &rt->prev_pkt[1], &rt->nb_prev_pkt[1]);
1850. 
1851.     ff_rtmp_packet_destroy(&spkt);
          ^
1852. 
1853.     return ret;

libavformat/rtmppkt.c:427:1: start of procedure ff_rtmp_packet_destroy()
  425. }
  426. 
  427. void ff_rtmp_packet_destroy(RTMPPacket *pkt)
       ^
  428. {
  429.     if (!pkt)

libavformat/rtmppkt.c:429:10: Taking false branch
  427. void ff_rtmp_packet_destroy(RTMPPacket *pkt)
  428. {
  429.     if (!pkt)
                ^
  430.         return;
  431.     av_freep(&pkt->data);

libavformat/rtmppkt.c:431:5: Skipping av_freep(): empty list of specs
  429.     if (!pkt)
  430.         return;
  431.     av_freep(&pkt->data);
           ^
  432.     pkt->size = 0;
  433. }

libavformat/rtmppkt.c:432:5: 
  430.         return;
  431.     av_freep(&pkt->data);
  432.     pkt->size = 0;
           ^
  433. }
  434. 

libavformat/rtmppkt.c:433:1: return from a call to ff_rtmp_packet_destroy
  431.     av_freep(&pkt->data);
  432.     pkt->size = 0;
  433. }
       ^
  434. 
  435. int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end)

libavformat/rtmpproto.c:1853:5: 
1851.     ff_rtmp_packet_destroy(&spkt);
1852. 
1853.     return ret;
          ^
1854. }
1855. 

libavformat/rtmpproto.c:1854:1: return from a call to write_begin
1852. 
1853.     return ret;
1854. }
      ^
1855. 
1856. 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_USER_CONTROL, 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_USER_CONTROL, 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 (size > (INT_MAX - 16))\n        return NULL;\n#if 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}']