Fix another realloc() that can easily be fixed. The other one in the file
authorJP Dinger <jpd@videolan.org>
Fri, 24 Jul 2009 11:36:51 +0000 (13:36 +0200)
committerJP Dinger <jpd@videolan.org>
Fri, 24 Jul 2009 11:36:51 +0000 (13:36 +0200)
I don't immediately see a solution for.

modules/demux/playlist/asx.c

index 12cd294..56e9f07 100644 (file)
@@ -89,7 +89,9 @@ static int StoreString( demux_t *p_demux, char **ppsz_string,
         }
         *buf++ = '\0';
 
-        buf = *ppsz_string = realloc (*ppsz_string, buf - *ppsz_string);
+        buf = realloc (*ppsz_string, buf - *ppsz_string);
+        if( buf )
+            *ppsz_string = buf;
     }
     return VLC_SUCCESS;
 }
@@ -250,6 +252,7 @@ static int Demux( demux_t *p_demux )
 
             if( i_read < p_sys->i_data_len - i_pos ) break; /* Done */
 
+            /* XXX this looks fishy and inefficient */
             i_pos += i_read;
             p_sys->i_data_len += 1024;
             p_sys->psz_data = realloc( p_sys->psz_data, p_sys->i_data_len * sizeof( char * ) +1 );