[vlc-devel] commit: Fix another realloc() that can easily be fixed. The other one in the file (JP Dinger )

git version control git at videolan.org
Fri Jul 24 13:38:26 CEST 2009


vlc | branch: master | JP Dinger <jpd at videolan.org> | Fri Jul 24 13:36:51 2009 +0200| [8baae61a21c1ea12076df2987476c4fedb16bee8] | committer: JP Dinger 

Fix another realloc() that can easily be fixed. The other one in the file
I don't immediately see a solution for.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8baae61a21c1ea12076df2987476c4fedb16bee8
---

 modules/demux/playlist/asx.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c
index 12cd294..56e9f07 100644
--- a/modules/demux/playlist/asx.c
+++ b/modules/demux/playlist/asx.c
@@ -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 );




More information about the vlc-devel mailing list