]> git.sesse.net Git - vlc/commitdiff
Another bunch of memory leaks in realrtsp plugin
authorJean-Paul Saman <jpsaman@videolan.org>
Sun, 25 Sep 2005 17:06:08 +0000 (17:06 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Sun, 25 Sep 2005 17:06:08 +0000 (17:06 +0000)
modules/access/rtsp/real_sdpplin.c

index 80569bf6a3eea9394ba4825f7fa098a2d7694a67..0a7d27dfa9b9c06ccb98a9ab07e0ceb06bafa6b4 100644 (file)
@@ -315,7 +315,7 @@ sdpplin_t *sdpplin_parse(char *data)
             int len=strchr(data,'\n')-data;
             memcpy(buf, data, len+1);
             buf[len]=0;
-        printf("libreal: sdpplin: not handled: '%s'\n", buf);
+            printf("libreal: sdpplin: not handled: '%s'\n", buf);
 #endif
             data=nl(data);
         }
@@ -328,6 +328,43 @@ sdpplin_t *sdpplin_parse(char *data)
 
 void sdpplin_free(sdpplin_t *description)
 {
-  /* TODO: free strings */
-  free(description);
+    int i;
+
+    if( !description ) return;
+
+    for( i=0; i<description->stream_count; i++ )
+    {
+        if( description->stream[i] )
+        {
+            if( description->stream[i]->id ) free( description->stream[i]->id );
+            if( description->stream[i]->bandwidth ) free( description->stream[i]->bandwidth );
+            if( description->stream[i]->range ) free( description->stream[i]->range );
+            if( description->stream[i]->length ) free( description->stream[i]->length );
+            if( description->stream[i]->rtpmap ) free( description->stream[i]->rtpmap );
+            if( description->stream[i]->mimetype ) free( description->stream[i]->mimetype );
+            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]->rmff_flags ) free( description->stream[i]->rmff_flags );
+            if( description->stream[i]->asm_rule_book ) free( description->stream[i]->asm_rule_book );
+        }
+    }
+    free( description->stream );
+
+    if( description->owner ) free( description->owner );
+    if( description->session_name ) free( description->session_name );
+    if( description->session_info ) free( description->session_info );
+    if( description->uri ) free( description->uri );
+    if( description->email ) free( description->email );
+    if( description->phone ) free( description->phone );
+    if( description->connection ) free( description->connection );
+    if( description->bandwidth ) free( description->bandwidth );
+    if( description->title ) free( description->title );
+    if( description->author ) free( description->author );
+    if( description->copyright ) free( description->copyright );
+    if( description->keywords ) free( description->keywords );
+    if( description->asm_rule_book ) free( description->asm_rule_book );
+    if( description->abstract ) free( description->abstract );
+    if( description->range ) free( description->range );
+    free(description);
 }