[cvs-annodex] commit (/annodex): liboggz/trunk/src/liboggz/oggz.c
liboggz/trunk/src/liboggz/oggz_auto.c
conrad
nobody at lists.annodex.net
Mon Sep 20 16:06:28 EST 2004
Update of /annodex (new revision 585)
Modified files:
liboggz/trunk/src/liboggz/oggz.c
liboggz/trunk/src/liboggz/oggz_auto.c
Log 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()
Modified: liboggz/trunk/src/liboggz/oggz.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz.c 2004-09-16 05:27:59 UTC (rev 584)
+++ liboggz/trunk/src/liboggz/oggz.c 2004-09-20 06:06:28 UTC (rev 585)
@@ -185,6 +185,9 @@
oggz_vector_foreach (oggz->streams, oggz_stream_clear);
oggz_vector_delete (oggz->streams);
+ if (oggz->metric_internal)
+ oggz_free (oggz->metric_user_data);
+
if (oggz->file != NULL) {
if (fclose (oggz->file) == EOF) {
return OGGZ_ERR_SYSTEM;
Modified: liboggz/trunk/src/liboggz/oggz_auto.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_auto.c 2004-09-16 05:27:59 UTC (rev 584)
+++ liboggz/trunk/src/liboggz/oggz_auto.c 2004-09-20 06:06:28 UTC (rev 585)
@@ -47,6 +47,11 @@
#include "oggz_byteorder.h"
#include "oggz_macros.h"
+/* Allow use of internal metrics; ie. the user_data for these gets free'd
+ * when the metric is overwritten, or on close */
+int oggz_set_metric_internal (OGGZ * oggz, long serialno, OggzMetric metric,
+ void * user_data, int internal);
+
#define INT32_LE_AT(x) _le_32((*(ogg_int32_t *)(x)))
#define INT32_BE_AT(x) _be_32((*(ogg_int32_t *)(x)))
#define INT64_LE_AT(x) _le_64((*(ogg_int64_t *)(x)))
@@ -173,8 +178,8 @@
tdata->keyframe_shift);
#endif
- /*oggz_set_metric_internal (oggz, serialno, auto_theora_metric, tdata, 1);*/
- oggz_set_metric (oggz, serialno, auto_theora_metric, tdata);
+ oggz_set_metric_internal (oggz, serialno, auto_theora_metric, tdata, 1);
+ /*oggz_set_metric (oggz, serialno, auto_theora_metric, tdata);*/
return 1;
}
--
conrad
More information about the cvs-annodex
mailing list