Commit 2816e827 authored by conrad's avatar conrad

oggz-chop: remove memory leaks (add state cleanup routine); tested with

valgrind memcheck+leakcheck


git-svn-id: http://svn.annodex.net/liboggz/trunk@3527 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent 9bdf465d
......@@ -97,6 +97,25 @@ track_state_add (OggzTable * state, long serialno)
}
}
static void
state_init (OCState * state)
{
state->tracks = oggz_table_new ();
state->written_accum = 0;
}
static void
state_clear (OCState * state)
{
int i, ntracks;
ntracks = oggz_table_size (state->tracks);
for (i = 0; i < ntracks; i++) {
track_state_delete (oggz_table_nth(state->tracks, i, NULL));
}
oggz_table_delete (state->tracks);
}
/************************************************************
* ogg_page helpers
*/
......@@ -137,7 +156,7 @@ _ogg_page_set_eos (const ogg_page * og)
}
static void
fwrite_ogg_page (FILE * outfile, ogg_page * og)
fwrite_ogg_page (FILE * outfile, const ogg_page * og)
{
if (og == NULL) return;
......@@ -428,8 +447,7 @@ chop (OCState * state)
{
OGGZ * oggz;
state->tracks = oggz_table_new ();
state->written_accum = 0;
state_init (state);
if (strcmp (state->infilename, "-") == 0) {
oggz = oggz_open_stdio (stdin, OGGZ_READ|OGGZ_AUTO);
......@@ -456,5 +474,7 @@ chop (OCState * state)
oggz_close (oggz);
state_clear (state);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment