From ac5d629479c4594c455d4c9d6e9610d725386feb Mon Sep 17 00:00:00 2001 From: rtogni Date: Mon, 1 Jan 2007 22:32:09 +0000 Subject: Memleak fix (implement sdpplin_free() and use it) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21806 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/realrtsp/real.c | 1 + stream/realrtsp/sdpplin.c | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) (limited to 'stream') diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c index 84a3cdd18f..3ad4fa9a7f 100644 --- a/stream/realrtsp/real.c +++ b/stream/realrtsp/real.c @@ -337,6 +337,7 @@ static rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t b rmff_fix_header(header); buf = xbuffer_free(buf); + sdpplin_free(desc); return header; } diff --git a/stream/realrtsp/sdpplin.c b/stream/realrtsp/sdpplin.c index 359fe10678..862fe0dbfb 100644 --- a/stream/realrtsp/sdpplin.c +++ b/stream/realrtsp/sdpplin.c @@ -360,7 +360,33 @@ sdpplin_t *sdpplin_parse(char *data) { void sdpplin_free(sdpplin_t *description) { - /* TODO: free strings */ + int i; + + if (!description) + return; + + for (i = 0; i < description->stream_count; i++) { + if (description->stream[i]) { + if (description->stream[i]->stream_name) + free(description->stream[i]->stream_name); + if (description->stream[i]->mime_type) + free(description->stream[i]->mime_type); + if (description->stream[i]->mlti_data) + free(description->stream[i]->mlti_data); + if (description->stream[i]->asm_rule_book) + free(description->stream[i]->asm_rule_book); + } + } + + if (description->title) + free(description->title); + if (description->author) + free(description->author); + if (description->copyright) + free(description->copyright); + if (description->abstract) + free(description->abstract); + free(description); } -- cgit v1.2.3