Browse code

ffserver: Plug some memory leaks

Patch by Howard Chu, hyc at highlandsun dot com

Originally committed as revision 23290 to svn://svn.ffmpeg.org/ffmpeg/trunk

Howard Chu authored on 2010/05/25 04:05:22
Showing 1 changed files
... ...
@@ -847,6 +847,8 @@ static void close_connection(HTTPContext *c)
847 847
         ctx = c->rtp_ctx[i];
848 848
         if (ctx) {
849 849
             av_write_trailer(ctx);
850
+            av_metadata_free(&ctx->metadata);
851
+            av_free(ctx->streams[0]);
850 852
             av_free(ctx);
851 853
         }
852 854
         h = c->rtp_handles[i];
... ...
@@ -2280,6 +2282,7 @@ static int http_prepare_data(HTTPContext *c)
2280 2280
             http_log("Error writing output header\n");
2281 2281
             return -1;
2282 2282
         }
2283
+        av_metadata_free(&c->fmt_ctx.metadata);
2283 2284
 
2284 2285
         len = url_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
2285 2286
         c->buffer_ptr = c->pb_buffer;
... ...
@@ -2954,6 +2957,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
2954 2954
     }
2955 2955
     *pbuffer = av_mallocz(2048);
2956 2956
     avf_sdp_create(&avc, 1, *pbuffer, 2048);
2957
+    av_metadata_free(&avc->metadata);
2957 2958
     av_free(avc);
2958 2959
 
2959 2960
     return strlen(*pbuffer);
... ...
@@ -3010,6 +3014,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url)
3010 3010
     url_fprintf(c->pb, "Content-Length: %d\r\n", content_length);
3011 3011
     url_fprintf(c->pb, "\r\n");
3012 3012
     put_buffer(c->pb, content, content_length);
3013
+    av_free(content);
3013 3014
 }
3014 3015
 
3015 3016
 static HTTPContext *find_rtp_session(const char *session_id)