Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
6ba8c0b2
Commit
6ba8c0b2
authored
Feb 29, 2004
by
Karl Heyes
Browse files
free up any per-client format specific resources, fixes a small memory
leak with mp3 streams svn path=/trunk/icecast/; revision=5873
parent
a255c92b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/client.c
View file @
6ba8c0b2
...
...
@@ -63,6 +63,10 @@ void client_destroy(client_t *client)
while
((
refbuf
=
refbuf_queue_remove
(
&
client
->
queue
)))
refbuf_release
(
refbuf
);
/* we need to free client specific format data (if any) */
if
(
client
->
free_client_data
)
client
->
free_client_data
(
client
);
free
(
client
->
username
);
free
(
client
);
...
...
src/client.h
View file @
6ba8c0b2
...
...
@@ -42,6 +42,9 @@ typedef struct _client_tag
/* Format-handler-specific data for this client */
void
*
format_data
;
/* function to call to release format specific resources */
void
(
*
free_client_data
)(
struct
_client_tag
*
client
);
}
client_t
;
client_t
*
client_create
(
connection_t
*
con
,
http_parser_t
*
parser
);
...
...
src/format_mp3.c
View file @
6ba8c0b2
...
...
@@ -59,6 +59,7 @@ static int format_mp3_get_buffer(format_plugin_t *self, char *data,
static
refbuf_queue_t
*
format_mp3_get_predata
(
format_plugin_t
*
self
);
static
void
*
format_mp3_create_client_data
(
format_plugin_t
*
self
,
source_t
*
source
,
client_t
*
client
);
static
void
free_mp3_client_data
(
client_t
*
client
);
static
int
format_mp3_write_buf_to_client
(
format_plugin_t
*
self
,
client_t
*
client
,
unsigned
char
*
buf
,
int
len
);
static
void
format_mp3_send_headers
(
format_plugin_t
*
self
,
...
...
@@ -394,6 +395,7 @@ static void *format_mp3_create_client_data(format_plugin_t *self,
data
->
interval
=
ICY_METADATA_INTERVAL
;
data
->
offset
=
0
;
client
->
free_client_data
=
free_mp3_client_data
;
metadata
=
httpp_getvar
(
client
->
parser
,
"icy-metadata"
);
if
(
metadata
)
...
...
@@ -402,6 +404,14 @@ static void *format_mp3_create_client_data(format_plugin_t *self,
return
data
;
}
static
void
free_mp3_client_data
(
client_t
*
client
)
{
free
(
client
->
format_data
);
client
->
format_data
=
NULL
;
}
static
void
format_mp3_send_headers
(
format_plugin_t
*
self
,
source_t
*
source
,
client_t
*
client
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment