From dc5bd076724c267a459c387a577b466539462af2 Mon Sep 17 00:00:00 2001 From: Karl Heyes Date: Thu, 14 Oct 2004 20:33:25 +0000 Subject: [PATCH] small updates, fix small memory leaks, unintialised pointer and sync stat names with multi-codec module for consistency svn path=/icecast/branches/kh/icecast/; revision=8002 --- src/cfgfile.c | 2 +- src/connection.c | 2 +- src/format_vorbis.c | 17 ++++++++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/cfgfile.c b/src/cfgfile.c index 60b3be3a..511ecace 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -219,7 +219,7 @@ void config_clear(ice_config_t *c) free(dirnode); dirnode = nextdirnode; } -#ifdef HAVE_YP +#ifdef USE_YP i = 0; while (i < c->num_yp_directories) { diff --git a/src/connection.c b/src/connection.c index 60ee43ca..2cd55451 100644 --- a/src/connection.c +++ b/src/connection.c @@ -480,7 +480,7 @@ int connection_complete_source (source_t *source) return 0; } - WARN1("Request to add source when maximum source limit" + WARN1("Request to add source when maximum source limit " "reached %d", global.sources); global_unlock(); diff --git a/src/format_vorbis.c b/src/format_vorbis.c index 631d7570..f1bd74d9 100644 --- a/src/format_vorbis.c +++ b/src/format_vorbis.c @@ -118,7 +118,7 @@ int format_ogg_get_plugin (source_t *source) vstate_t *state; vorbis_comment vc; - plugin = (format_plugin_t *)malloc(sizeof(format_plugin_t)); + plugin = (format_plugin_t *)calloc(1, sizeof(format_plugin_t)); plugin->type = FORMAT_TYPE_OGG; plugin->format_description = "Ogg Vorbis"; @@ -162,6 +162,14 @@ void format_vorbis_free_plugin (format_plugin_t *plugin) if (state->prev_packet) free_ogg_packet (state->prev_packet); + while (state->headers_head) + { + refbuf_t *to_go = state->headers_head; + state->headers_head = to_go->next; + /* printf ("releasing vorbis header %p\n", to_go); */ + refbuf_release (to_go); + } + ogg_packet_clear (&state->url_comment); free (state); @@ -294,7 +302,6 @@ static refbuf_t *get_buffer_finished (vstate_t *source_vorbis) } ogg_stream_clear (&source_vorbis->out_os); ogg_stream_init (&source_vorbis->out_os, get_next_serialno()); - printf ("clearing up header pages \n"); refbuf = source_vorbis->headers_head; while (refbuf) { @@ -442,9 +449,9 @@ static int process_vorbis_incoming_hdrs (source_t *source) tag = "unknown"; stats_event (source->mount, "artist", tag); - stats_event_args (source->mount, "ice-samplerate", "%ld", (long)source_vorbis->vi.rate); - stats_event_args (source->mount, "ice-channels", "%ld", (long)source_vorbis->vi.channels); - stats_event_args (source->mount, "ice-bitrate", "%ld", (long)source_vorbis->vi.bitrate_nominal/1024); + stats_event_args (source->mount, "audio-samplerate", "%ld", (long)source_vorbis->vi.rate); + stats_event_args (source->mount, "audio-channels", "%ld", (long)source_vorbis->vi.channels); + stats_event_args (source->mount, "audio-bitrate", "%ld", (long)source_vorbis->vi.bitrate_nominal); /* set queued pages to contain a 1/4 of a second worth of samples */ source_vorbis->page_samples_trigger = source_vorbis->vi.rate / 4;