[vlc-devel] commit: Fix use of realloc and remove dead code. (Jean-Paul Saman )

git version control git at videolan.org
Thu Nov 27 10:09:05 CET 2008


vlc | branch: 0.9-trickplay | Jean-Paul Saman <jpsaman at videolan.org> | Thu Nov 13 18:44:32 2008 +0100| [22d094d937c96919a490bcef3f498feade0cf730] | committer: Jean-Paul Saman 

Fix use of realloc and remove dead code.

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

 src/input/es_out.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index 1319e05..ba33a1b 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1579,7 +1579,7 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
 {
     es_out_sys_t *p_sys = out->p_sys;
     bool  b, *pb;
-    int         i, *pi;
+    int   i, *pi;
 
     es_out_id_t *es;
 
@@ -1831,26 +1831,20 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
 
             if( p_fmt->i_extra )
             {
+                uint8_t *p_tmp;
                 es->fmt.i_extra = p_fmt->i_extra;
-                es->fmt.p_extra = realloc( es->fmt.p_extra, p_fmt->i_extra );
+                p_tmp = realloc( es->fmt.p_extra, p_fmt->i_extra );
+                if( !p_tmp )
+                    return VLC_ENOMEM;
+                es->fmt.p_extra = p_tmp;
                 memcpy( es->fmt.p_extra, p_fmt->p_extra, p_fmt->i_extra );
 
                 if( !es->p_dec ) return VLC_SUCCESS;
 
-#if 1
                 input_DecoderDelete( es->p_dec );
                 es->p_dec = input_DecoderNew( p_sys->p_input,
                                               &es->fmt, false );
-
-#else
-                es->p_dec->fmt_in.i_extra = p_fmt->i_extra;
-                es->p_dec->fmt_in.p_extra =
-                    realloc( es->p_dec->fmt_in.p_extra, p_fmt->i_extra );
-                memcpy( es->p_dec->fmt_in.p_extra,
-                        p_fmt->p_extra, p_fmt->i_extra );
-#endif
             }
-
             return VLC_SUCCESS;
         }
 




More information about the vlc-devel mailing list