Commit 97c19f23 authored by Gildas Bazin's avatar Gildas Bazin

* src/input/input.c: fixed memleaks.
* src/input/input_info.c: small bug fix.
* modules/stream_out/standard.c: fixed memleaks.
parent e99c3250
......@@ -2,7 +2,7 @@
* standard.c
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: standard.c,v 1.16 2003/11/21 15:32:08 fenrir Exp $
* $Id: standard.c,v 1.17 2004/01/15 23:40:44 gbazin Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
......@@ -69,7 +69,8 @@ static int Open( vlc_object_t *p_this )
{
sout_stream_t *p_stream = (sout_stream_t*)p_this;
sout_instance_t *p_sout = p_stream->p_sout;
sout_stream_sys_t *p_sys = malloc( sizeof( sout_stream_sys_t) );
slp_session_t *p_slp = NULL;
sap_session_t *p_sap = NULL;
char *psz_mux = sout_cfg_find_value( p_stream->p_cfg, "mux" );
char *psz_access = sout_cfg_find_value( p_stream->p_cfg, "access" );
......@@ -87,9 +88,6 @@ static int Open( vlc_object_t *p_this )
char *psz_mux_byext = NULL;
p_sys->p_sap = NULL;
p_sys->p_slp = NULL;
msg_Dbg( p_this, "creating `%s/%s://%s'",
psz_access, psz_mux, psz_url );
......@@ -257,11 +255,11 @@ static int Open( vlc_object_t *p_this )
}
msg_Dbg( p_sout , "Creating SAP with IPv%i", atoi(psz_ipv) );
p_sys->p_sap = sout_SAPNew( p_sout , psz_url ,
p_sap = sout_SAPNew( p_sout , psz_url ,
p_sap_cfg->psz_value ? p_sap_cfg->psz_value : psz_url,
atoi(psz_ipv), psz_v6_scope );
if( !p_sys->p_sap )
if( !p_sap )
msg_Err( p_sout,"Unable to initialize SAP. SAP disabled");
}
......@@ -278,14 +276,15 @@ static int Open( vlc_object_t *p_this )
}
else
{
p_sys->p_slp = (slp_session_t*)malloc(sizeof(slp_session_t));
if(!p_sys->p_slp)
p_slp = (slp_session_t*)malloc(sizeof(slp_session_t));
if(!p_slp)
{
msg_Warn(p_sout,"Out of memory");
if( p_sap ) free( p_sap );
return -1;
}
p_sys->p_slp->psz_url= strdup(psz_url);
p_sys->p_slp->psz_name = strdup(
p_slp->psz_url= strdup(psz_url);
p_slp->psz_name = strdup(
p_slp_cfg->psz_value ? p_slp_cfg->psz_value : psz_url);
}
}
......@@ -294,14 +293,15 @@ static int Open( vlc_object_t *p_this )
/* XXX beurk */
p_sout->i_preheader = __MAX( p_sout->i_preheader, p_mux->i_preheader );
p_sys->p_mux = p_mux;
p_stream->pf_add = Add;
p_stream->pf_del = Del;
p_stream->pf_send = Send;
p_stream->p_sys = p_sys;
p_stream->p_sys = malloc( sizeof( sout_stream_sys_t) );
p_stream->p_sys->p_mux = p_mux;
p_stream->p_sys->p_slp = p_slp;
p_stream->p_sys->p_sap = p_sap;
return VLC_SUCCESS;
}
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
* $Id: input.c,v 1.275 2004/01/10 23:46:39 sigmunau Exp $
* $Id: input.c,v 1.276 2004/01/15 23:40:44 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -85,7 +85,6 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
playlist_item_t *p_item )
{
input_thread_t * p_input; /* thread descriptor */
input_info_category_t * p_info;
vlc_value_t val;
int i,j;
......@@ -245,23 +244,15 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
p_input->stream.control.i_status = INIT_S;
p_input->stream.control.i_rate = DEFAULT_RATE;
p_input->stream.control.b_mute = 0;
p_input->stream.control.b_grayscale = config_GetInt( p_input, "grayscale" );
/* Initialize input info */
p_input->stream.p_info = malloc( sizeof( input_info_category_t ) );
if( !p_input->stream.p_info )
{
msg_Err( p_input, "No memory!" );
return NULL;
}
p_input->stream.p_info->psz_name = strdup("General") ;
p_input->stream.p_info->p_info = NULL;
p_input->stream.p_info->p_next = NULL;
p_input->stream.control.b_grayscale = config_GetInt( p_input, "grayscale");
msg_Info( p_input, "playlist item `%s'", p_input->psz_source );
p_info = input_InfoCategory( p_input, _("General") );
input_AddInfo( p_info, _("Playlist Item"), p_input->psz_source );
/* Initialize input info */
p_input->stream.p_info = NULL;
p_input->stream.p_info = input_InfoCategory( p_input, _("General") );
input_AddInfo( p_input->stream.p_info, _("Playlist Item"),
p_input->psz_source );
vlc_object_attach( p_input, p_parent );
/* Create thread and wait for its readiness. */
......@@ -269,6 +260,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
VLC_THREAD_PRIORITY_INPUT, VLC_TRUE ) )
{
msg_Err( p_input, "cannot create input thread" );
input_DelInfo( p_input );
free( p_input );
return NULL;
}
......@@ -331,6 +323,8 @@ static int RunThread( input_thread_t *p_input )
/* Tell we're dead */
p_input->b_dead = 1;
input_DelInfo( p_input );
return 0;
}
......
......@@ -2,7 +2,7 @@
* input_info.c: Convenient functions to handle the input info structures
*****************************************************************************
* Copyright (C) 1998-2004 VideoLAN
* $Id: input_info.c,v 1.12 2004/01/06 12:02:06 zorglub Exp $
* $Id: input_info.c,v 1.13 2004/01/15 23:40:44 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -69,7 +69,7 @@ input_info_category_t * input_InfoCategory( input_thread_t * p_input,
p_category->psz_name = strdup( psz_name );
p_category->p_next = NULL;
p_category->p_info = NULL;
p_prev->p_next = p_category;
if( p_prev ) p_prev->p_next = p_category;
return p_category;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment