Fix mem leak
authorChristophe Mutricy <xtophe@videolan.org>
Sat, 22 Nov 2008 16:04:24 +0000 (16:04 +0000)
committerChristophe Mutricy <xtophe@videolan.org>
Sat, 22 Nov 2008 16:04:24 +0000 (16:04 +0000)
Closes #2305

modules/access/rtsp/real_sdpplin.c

index 229501c..be950c2 100644 (file)
@@ -231,16 +231,18 @@ sdpplin_t *sdpplin_parse(char *data) {
 
   sdpplin_t        *desc = malloc(sizeof(sdpplin_t));
   sdpplin_stream_t *stream;
 
   sdpplin_t        *desc = malloc(sizeof(sdpplin_t));
   sdpplin_stream_t *stream;
-  char             *buf=malloc(BUFLEN);
-  char             *decoded=malloc(BUFLEN);
+  char             *buf=NULL;
+  char             *decoded=NULL;
   int              handled;
   int              len;
 
   if( !desc ) return NULL;
   int              handled;
   int              len;
 
   if( !desc ) return NULL;
+  buf = malloc(BUFLEN);
   if( !buf ) {
     free( desc );
     return NULL;
   }
   if( !buf ) {
     free( desc );
     return NULL;
   }
+  decoded = malloc(BUFLEN);
   if( !decoded ) {
     free( buf );
     free( desc );
   if( !decoded ) {
     free( buf );
     free( desc );