changeset 21788:04281be4fbdd

Memleak fix (implement sdpplin_free() and use it)
author rtogni
date Mon, 01 Jan 2007 22:32:09 +0000
parents 899739212237
children b266f27109a6
files stream/realrtsp/real.c stream/realrtsp/sdpplin.c
diffstat 2 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }
--- 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);
 }