libavformat/rmenc.c:330: error: Null Dereference
  pointer `buf1` last assigned on line 324 could be null and is dereferenced at line 330, column 9.

libavformat/rmenc.c:315:1: start of procedure rm_write_audio()
313. }
314. 
315. static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int flags)
     ^
316. {
317.     uint8_t *buf1;

libavformat/rmenc.c:318:5: 
316. {
317.     uint8_t *buf1;
318.     RMContext *rm = s->priv_data;
         ^
319.     ByteIOContext *pb = s->pb;
320.     StreamInfo *stream = rm->audio_stream;

libavformat/rmenc.c:319:5: 
317.     uint8_t *buf1;
318.     RMContext *rm = s->priv_data;
319.     ByteIOContext *pb = s->pb;
         ^
320.     StreamInfo *stream = rm->audio_stream;
321.     int i;

libavformat/rmenc.c:320:5: 
318.     RMContext *rm = s->priv_data;
319.     ByteIOContext *pb = s->pb;
320.     StreamInfo *stream = rm->audio_stream;
         ^
321.     int i;
322. 

libavformat/rmenc.c:324:5: 
322. 
323.     /* XXX: suppress this malloc */
324.     buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );
         ^
325. 
326.     write_packet_header(s, stream, size, !!(flags & PKT_FLAG_KEY));

libavutil/mem.c:42:1: start of procedure av_malloc()
  40.    linker will do it automatically */
  41. 
  42. void *av_malloc(unsigned int size)
      ^
  43. {
  44.     void *ptr;

libavutil/mem.c:50:8: Taking true branch
  48. 
  49.     /* let's disallow possible ambiguous cases */
  50.     if(size > (INT_MAX-16) )
             ^
  51.         return NULL;
  52. 

libavutil/mem.c:51:9: 
  49.     /* let's disallow possible ambiguous cases */
  50.     if(size > (INT_MAX-16) )
  51.         return NULL;
              ^
  52. 
  53. #ifdef CONFIG_MEMALIGN_HACK

libavutil/mem.c:92:1: return from a call to av_malloc
  90. #endif
  91.     return ptr;
  92. }
      ^
  93. 
  94. void *av_realloc(void *ptr, unsigned int size)

libavformat/rmenc.c:326:45: Condition is false
324.     buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );
325. 
326.     write_packet_header(s, stream, size, !!(flags & PKT_FLAG_KEY));
                                                 ^
327. 
328.     /* for AC3, the words seems to be reversed */

libavformat/rmenc.c:326:42: 
324.     buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );
325. 
326.     write_packet_header(s, stream, size, !!(flags & PKT_FLAG_KEY));
                                              ^
327. 
328.     /* for AC3, the words seems to be reversed */

libavformat/rmenc.c:326:5: Skipping write_packet_header(): empty list of specs
324.     buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );
325. 
326.     write_packet_header(s, stream, size, !!(flags & PKT_FLAG_KEY));
         ^
327. 
328.     /* for AC3, the words seems to be reversed */

libavformat/rmenc.c:329:9: 
327. 
328.     /* for AC3, the words seems to be reversed */
329.     for(i=0;i<size;i+=2) {
             ^
330.         buf1[i] = buf[i+1];
331.         buf1[i+1] = buf[i];

libavformat/rmenc.c:329:13: Loop condition is true. Entering loop body
327. 
328.     /* for AC3, the words seems to be reversed */
329.     for(i=0;i<size;i+=2) {
                 ^
330.         buf1[i] = buf[i+1];
331.         buf1[i+1] = buf[i];

libavformat/rmenc.c:330:9: 
328.     /* for AC3, the words seems to be reversed */
329.     for(i=0;i<size;i+=2) {
330.         buf1[i] = buf[i+1];
             ^
331.         buf1[i+1] = buf[i];
332.     }

static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int flags)
{
    uint8_t *buf1;
    RMContext *rm = s->priv_data;
    ByteIOContext *pb = s->pb;
    StreamInfo *stream = rm->audio_stream;
    int i;
    buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );
    write_packet_header(s, stream, size, !!(flags & PKT_FLAG_KEY));
    for(i=0;i<size;i+=2) {
        buf1[i] = buf[i+1];
        buf1[i+1] = buf[i];
    }
    put_buffer(pb, buf1, size);
    put_flush_packet(pb);
    stream->nb_frames++;
    av_free(buf1);
    return 0;
}
['static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int flags)\n{\n    uint8_t *buf1;\n    RMContext *rm = s->priv_data;\n    ByteIOContext *pb = s->pb;\n    StreamInfo *stream = rm->audio_stream;\n    int i;\n    buf1= (uint8_t*) av_malloc( size * sizeof(uint8_t) );\n    write_packet_header(s, stream, size, !!(flags & PKT_FLAG_KEY));\n    for(i=0;i<size;i+=2) {\n        buf1[i] = buf[i+1];\n        buf1[i+1] = buf[i];\n    }\n    put_buffer(pb, buf1, size);\n    put_flush_packet(pb);\n    stream->nb_frames++;\n    av_free(buf1);\n    return 0;\n}', 'void *av_malloc(unsigned int size)\n{\n    void *ptr;\n#ifdef CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#ifdef CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif defined (HAVE_MEMALIGN)\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']