Changeset 585

Show
Ignore:
Timestamp:
2004-09-19 23:06:28 (4 years ago)
Author:
conrad
Message:

Close a memory leak related to using OGGZ_AUTO with theora streams:

  • mark theora auto_metric as internal, ie. its user_data gets
    automatically free'd when the metric is updated.
  • free user_data for internal metrics associated with the whole
    OGGZ object (ie. not just stream-specific metrics) on oggz_close()
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • liboggz/trunk/src/liboggz/oggz.c

    r540 r585  
    185185  oggz_vector_foreach (oggz->streams, oggz_stream_clear); 
    186186  oggz_vector_delete (oggz->streams); 
     187 
     188  if (oggz->metric_internal) 
     189    oggz_free (oggz->metric_user_data); 
    187190 
    188191  if (oggz->file != NULL) { 
  • liboggz/trunk/src/liboggz/oggz_auto.c

    r573 r585  
    4848#include "oggz_macros.h" 
    4949 
     50/* Allow use of internal metrics; ie. the user_data for these gets free'd 
     51 * when the metric is overwritten, or on close */ 
     52int oggz_set_metric_internal (OGGZ * oggz, long serialno, OggzMetric metric, 
     53                              void * user_data, int internal); 
     54 
    5055#define INT32_LE_AT(x) _le_32((*(ogg_int32_t *)(x))) 
    5156#define INT32_BE_AT(x) _be_32((*(ogg_int32_t *)(x))) 
     
    174179#endif 
    175180 
    176   /*oggz_set_metric_internal (oggz, serialno, auto_theora_metric, tdata, 1);*/ 
    177   oggz_set_metric (oggz, serialno, auto_theora_metric, tdata); 
     181  oggz_set_metric_internal (oggz, serialno, auto_theora_metric, tdata, 1); 
     182  /*oggz_set_metric (oggz, serialno, auto_theora_metric, tdata);*/ 
    178183 
    179184  return 1;