Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Sep 2013 13:12:52 +0000 (15:12 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Sep 2013 13:26:06 +0000 (15:26 +0200)
* qatar/master:
  matroskaenc: Fix stray pointers left over from av_reallocp_array refactoring

Conflicts:
libavformat/matroskaenc.c

Mostly not merged as the buggy code was no longer part of FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/matroskaenc.c

@@@ -307,14 -300,15 +307,14 @@@ static int mkv_add_seekhead_entry(mkv_s
      if (seekhead->max_entries > 0 && seekhead->max_entries <= seekhead->num_entries)
          return -1;
  
 -    if ((err = av_reallocp_array(&seekhead->entries, seekhead->num_entries + 1,
 -                                 sizeof(*seekhead->entries))) < 0) {
 -        seekhead->num_entries = 0;
 -        return err;
 -    }
 +    entries = av_realloc_array(entries, seekhead->num_entries + 1, sizeof(mkv_seekhead_entry));
 +    if (entries == NULL)
 +        return AVERROR(ENOMEM);
++    seekhead->entries = entries;
  
-     entries[seekhead->num_entries  ].elementid = elementid;
-     entries[seekhead->num_entries++].segmentpos = filepos - seekhead->segment_offset;
+     seekhead->entries[seekhead->num_entries].elementid    = elementid;
+     seekhead->entries[seekhead->num_entries++].segmentpos = filepos - seekhead->segment_offset;
  
-     seekhead->entries = entries;
      return 0;
  }
  
@@@ -388,16 -382,16 +388,16 @@@ static int mkv_add_cuepoint(mkv_cues *c
      if (ts < 0)
          return 0;
  
 -    if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1,
 -                                 sizeof(*cues->entries))) < 0) {
 -        cues->num_entries = 0;
 -        return err;
 -    }
 +    entries = av_realloc_array(entries, cues->num_entries + 1, sizeof(mkv_cuepoint));
 +    if (entries == NULL)
 +        return AVERROR(ENOMEM);
++    cues->entries = entries;
  
-     entries[cues->num_entries  ].pts = ts;
-     entries[cues->num_entries  ].tracknum = stream + 1;
-     entries[cues->num_entries  ].cluster_pos = cluster_pos - cues->segment_offset;
-     entries[cues->num_entries++].relative_pos = relative_pos;
+     cues->entries[cues->num_entries].pts           = ts;
+     cues->entries[cues->num_entries].tracknum      = stream + 1;
 -    cues->entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
++    cues->entries[cues->num_entries].cluster_pos   = cluster_pos - cues->segment_offset;
++    cues->entries[cues->num_entries++].relative_pos= relative_pos;
  
-     cues->entries = entries;
      return 0;
  }