[xiph-cvs] cvs commit: httpp httpp.c httpp.h
Michael Smith
msmith at xiph.org
Fri May 3 08:04:57 PDT 2002
msmith 02/05/03 08:04:57
Modified: src config.c connection.c format_vorbis.c stats.c
. httpp.c httpp.h
Log:
Memory leaks. Lots of little ones.
Revision Changes Path
1.5 +11 -2 icecast/src/config.c
Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/config.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- config.c 2002/02/08 03:51:18 1.4
+++ config.c 2002/05/03 15:04:55 1.5
@@ -48,8 +48,9 @@
void config_shutdown(void)
{
- if (_config_filename) free(_config_filename);
+ ice_config_dir_t *dirnode, *nextdirnode;
+ if (_config_filename) free(_config_filename);
if (_configuration.location) free(_configuration.location);
if (_configuration.admin) free(_configuration.admin);
if (_configuration.source_password) free(_configuration.source_password);
@@ -58,8 +59,16 @@
if (_configuration.log_dir) free(_configuration.log_dir);
if (_configuration.access_log) free(_configuration.access_log);
if (_configuration.error_log) free(_configuration.error_log);
+ if (_configuration.bind_address) free(_configuration.bind_address);
+ dirnode = _configuration.dir_list;
+ while(dirnode) {
+ nextdirnode = dirnode->next;
+ free(dirnode->host);
+ free(dirnode);
+ dirnode = nextdirnode;
+ }
- memset(&_configuration, 0, sizeof(ice_config_t));
+ memset(&_configuration, 0, sizeof(ice_config_t));
}
int config_parse_file(const char *filename)
<p><p>1.10 +4 -1 icecast/src/connection.c
Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- connection.c 2002/03/22 22:41:16 1.9
+++ connection.c 2002/05/03 15:04:55 1.10
@@ -386,12 +386,16 @@
format_type_t format = format_get_type(contenttype);
if (format < 0) {
WARN1("Content-type \"%s\" not supported, dropping source", contenttype);
+ connection_close(con);
+ httpp_destroy(parser);
continue;
} else {
source = source_create(con, parser, httpp_getvar(parser, HTTPP_VAR_URI), format);
}
} else {
WARN0("No content-type header, cannot handle source");
+ connection_close(con);
+ httpp_destroy(parser);
continue;
}
@@ -400,7 +404,6 @@
sock_set_blocking(con->sock, SOCK_NONBLOCK);
thread_create("Source Thread", source_main, (void *)source, THREAD_DETACHED);
-
continue;
} else if (parser->req_type == httpp_req_stats) {
printf("DEBUG: stats connection...\n");
<p><p>1.6 +4 -0 icecast/src/format_vorbis.c
Index: format_vorbis.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/format_vorbis.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- format_vorbis.c 2002/04/05 09:28:25 1.5
+++ format_vorbis.c 2002/05/03 15:04:56 1.6
@@ -117,6 +117,10 @@
state->headbuf[i] = NULL;
}
}
+ /* Clear old stuff. Rarely but occasionally needed. */
+ ogg_stream_clear(&state->os);
+ vorbis_comment_clear(&state->vc);
+ vorbis_info_clear(&state->vi);
state->serialno = ogg_page_serialno(&state->og);
ogg_stream_init(&state->os, state->serialno);
<p><p>1.12 +1 -0 icecast/src/stats.c
Index: stats.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/stats.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- stats.c 2002/04/05 16:33:35 1.11
+++ stats.c 2002/05/03 15:04:56 1.12
@@ -814,6 +814,7 @@
stats_source_t *node = (stats_source_t *)key;
avl_tree_free(node->stats_tree, _free_stats);
free(node->source);
+ free(node);
return 1;
}
<p><p>1.6 +7 -1 httpp/httpp.c
Index: httpp.c
===================================================================
RCS file: /usr/local/cvsroot/httpp/httpp.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- httpp.c 2002/04/05 09:28:25 1.5
+++ httpp.c 2002/05/03 15:04:56 1.6
@@ -268,7 +268,7 @@
return NULL;
}
-void httpp_destroy(http_parser_t *parser)
+void httpp_clear(http_parser_t *parser)
{
parser->req_type = httpp_req_none;
if (parser->uri)
@@ -276,6 +276,12 @@
parser->uri = NULL;
avl_tree_free(parser->vars, _free_vars);
parser->vars = NULL;
+}
+
+void httpp_destroy(http_parser_t *parser)
+{
+ httpp_clear(parser);
+ free(parser);
}
char *_lowercase(char *str)
<p><p>1.2 +1 -0 httpp/httpp.h
Index: httpp.h
===================================================================
RCS file: /usr/local/cvsroot/httpp/httpp.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- httpp.h 2001/09/10 02:28:47 1.1
+++ httpp.h 2002/05/03 15:04:56 1.2
@@ -40,6 +40,7 @@
void httpp_setvar(http_parser_t *parser, char *name, char *value);
char *httpp_getvar(http_parser_t *parser, char *name);
void httpp_destroy(http_parser_t *parser);
+void httpp_clear(http_parser_t *parser);
#endif
<p><p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list