1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

fix double free bug with failed to start relays and add a guard on refbuf release

svn path=/icecast/trunk/icecast/; revision=9859
This commit is contained in:
Karl Heyes 2005-08-29 01:16:02 +00:00
parent a4b03ad26c
commit 1d5c1ebdd6
2 changed files with 4 additions and 4 deletions

View File

@ -66,6 +66,8 @@ void refbuf_addref(refbuf_t *self)
void refbuf_release(refbuf_t *self) void refbuf_release(refbuf_t *self)
{ {
if (self == NULL)
return;
self->_count--; self->_count--;
if (self->_count == 0) { if (self->_count == 0) {
while (self->associated) while (self->associated)
@ -76,7 +78,6 @@ void refbuf_release(refbuf_t *self)
} }
free(self->data); free(self->data);
free(self); free(self);
return;
} }
} }

View File

@ -243,9 +243,10 @@ static void *start_relay_stream (void *arg)
/* make sure only the client_destory frees these */ /* make sure only the client_destory frees these */
con = NULL; con = NULL;
parser = NULL; parser = NULL;
streamsock = SOCK_ERROR;
break; break;
} }
con = NULL;
parser = NULL;
client_set_queue (src->client, NULL); client_set_queue (src->client, NULL);
if (connection_complete_source (src, 0) < 0) if (connection_complete_source (src, 0) < 0)
@ -286,8 +287,6 @@ static void *start_relay_stream (void *arg)
avl_tree_unlock (global.source_tree); avl_tree_unlock (global.source_tree);
} }
if (con == NULL && streamsock != SOCK_ERROR)
sock_close (streamsock);
if (con) if (con)
connection_close (con); connection_close (con);
src->con = NULL; src->con = NULL;