# HG changeset patch # User rtogni # Date 1167690729 0 # Node ID 04281be4fbdd541cddabe90a2d9ccf21e109866e # Parent 8997392122377bde03098ca8934970aa60af54c5 Memleak fix (implement sdpplin_free() and use it) diff -r 899739212237 -r 04281be4fbdd stream/realrtsp/real.c --- a/stream/realrtsp/real.c Mon Jan 01 17:57:16 2007 +0000 +++ b/stream/realrtsp/real.c Mon Jan 01 22:32:09 2007 +0000 @@ -337,6 +337,7 @@ rmff_fix_header(header); buf = xbuffer_free(buf); + sdpplin_free(desc); return header; } diff -r 899739212237 -r 04281be4fbdd stream/realrtsp/sdpplin.c --- a/stream/realrtsp/sdpplin.c Mon Jan 01 17:57:16 2007 +0000 +++ b/stream/realrtsp/sdpplin.c Mon Jan 01 22:32:09 2007 +0000 @@ -360,7 +360,33 @@ 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); }