From 25cdd31d04c3e4a2771fb704c6beb24d13ee26a4 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 17 May 2002 00:58:14 +0000 Subject: [PATCH 1/1] * ./src/interface/intf_msg.c, src/interface/intf_playlist.c: disabled calls to realloc(_,0) in a similar way to input_programs.c. --- src/input/input_programs.c | 4 ++-- src/interface/intf_msg.c | 14 +++++++++++--- src/interface/intf_playlist.c | 14 +++++++++++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/input/input_programs.c b/src/input/input_programs.c index 1d35952023..44651497c0 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -1,8 +1,8 @@ /***************************************************************************** * input_programs.c: es_descriptor_t, pgrm_descriptor_t management ***************************************************************************** - * Copyright (C) 1999-2001 VideoLAN - * $Id: input_programs.c,v 1.87 2002/05/16 13:20:22 gbazin Exp $ + * Copyright (C) 1999-2002 VideoLAN + * $Id: input_programs.c,v 1.88 2002/05/17 00:58:14 sam Exp $ * * Authors: Christophe Massiot * diff --git a/src/interface/intf_msg.c b/src/interface/intf_msg.c index d17fa554d6..bc912977bb 100644 --- a/src/interface/intf_msg.c +++ b/src/interface/intf_msg.c @@ -4,7 +4,7 @@ * interface, such as message output. See config.h for output configuration. ***************************************************************************** * Copyright (C) 1998-2001 VideoLAN - * $Id: intf_msg.c,v 1.48 2002/04/24 00:36:24 sam Exp $ + * $Id: intf_msg.c,v 1.49 2002/05/17 00:58:13 sam Exp $ * * Authors: Vincent Seguin * @@ -180,8 +180,16 @@ void intf_MsgUnsub( intf_subscription_t *p_sub ) } msg_bank.i_sub--; - msg_bank.pp_sub = realloc( msg_bank.pp_sub, - msg_bank.i_sub * sizeof( intf_subscription_t* ) ); + if( msg_bank.i_sub ) + { + msg_bank.pp_sub = realloc( msg_bank.pp_sub, + msg_bank.i_sub * sizeof( intf_subscription_t* ) ); + } + else + { + free( msg_bank.pp_sub ); + msg_bank.pp_sub = NULL; + } vlc_mutex_unlock( &msg_bank.lock ); } diff --git a/src/interface/intf_playlist.c b/src/interface/intf_playlist.c index c81bdd3570..300c8c4df4 100644 --- a/src/interface/intf_playlist.c +++ b/src/interface/intf_playlist.c @@ -2,7 +2,7 @@ * intf_playlist.c : Playlist management functions ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: intf_playlist.c,v 1.13 2002/01/10 04:11:25 sam Exp $ + * $Id: intf_playlist.c,v 1.14 2002/05/17 00:58:13 sam Exp $ * * Authors: Samuel Hocevar * @@ -198,8 +198,16 @@ int intf_PlaylistDelete( playlist_t * p_playlist, int i_pos ) /* Decrement playlist size */ p_playlist->i_size--; - p_playlist->p_item = realloc( p_playlist->p_item, - p_playlist->i_size * sizeof( playlist_item_t ) ); + if( p_playlist->i_size ) + { + p_playlist->p_item = realloc( p_playlist->p_item, + p_playlist->i_size * sizeof( playlist_item_t ) ); + } + else + { + free( p_playlist->p_item ); + p_playlist->p_item = NULL; + } intf_WarnMsg( 3, "intf: removed `%s' from playlist", psz_name ); -- 2.39.5