Commit 740dd861 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

access: allocate p_sys vlc_malloc/vlc_calloc

parent 9635a5c8
...@@ -341,8 +341,7 @@ static uint16_t channel_maps[] = { ...@@ -341,8 +341,7 @@ static uint16_t channel_maps[] = {
static int Open (vlc_object_t *obj) static int Open (vlc_object_t *obj)
{ {
demux_t *demux = (demux_t *)obj; demux_t *demux = (demux_t *)obj;
demux_sys_t *sys = malloc (sizeof (*sys)); demux_sys_t *sys = vlc_malloc(obj, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -361,7 +360,6 @@ static int Open (vlc_object_t *obj) ...@@ -361,7 +360,6 @@ static int Open (vlc_object_t *obj)
{ {
msg_Err (demux, "cannot open ALSA device \"%s\": %s", device, msg_Err (demux, "cannot open ALSA device \"%s\": %s", device,
snd_strerror (val)); snd_strerror (val));
free (sys);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
sys->pcm = pcm; sys->pcm = pcm;
...@@ -510,7 +508,6 @@ static int Open (vlc_object_t *obj) ...@@ -510,7 +508,6 @@ static int Open (vlc_object_t *obj)
return VLC_SUCCESS; return VLC_SUCCESS;
error: error:
snd_pcm_close (pcm); snd_pcm_close (pcm);
free (sys);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -523,5 +520,4 @@ static void Close (vlc_object_t *obj) ...@@ -523,5 +520,4 @@ static void Close (vlc_object_t *obj)
vlc_join (sys->thread, NULL); vlc_join (sys->thread, NULL);
snd_pcm_close (sys->pcm); snd_pcm_close (sys->pcm);
free (sys);
} }
...@@ -73,7 +73,7 @@ static int Open(vlc_object_t *object) ...@@ -73,7 +73,7 @@ static int Open(vlc_object_t *object)
if (!input) if (!input)
return VLC_EGENERIC; return VLC_EGENERIC;
access_sys_t *sys = malloc(sizeof (*sys)); access_sys_t *sys = vlc_malloc(object, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -84,7 +84,6 @@ static int Open(vlc_object_t *object) ...@@ -84,7 +84,6 @@ static int Open(vlc_object_t *object)
if (sys->attachment == NULL) { if (sys->attachment == NULL) {
msg_Err(access, "Failed to find the attachment '%s'", msg_Err(access, "Failed to find the attachment '%s'",
access->psz_location); access->psz_location);
free(sys);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -106,7 +105,6 @@ static void Close(vlc_object_t *object) ...@@ -106,7 +105,6 @@ static void Close(vlc_object_t *object)
access_sys_t *sys = access->p_sys; access_sys_t *sys = access->p_sys;
vlc_input_attachment_Delete(sys->attachment); vlc_input_attachment_Delete(sys->attachment);
free(sys);
} }
/* */ /* */
......
...@@ -124,7 +124,7 @@ static int SetupAvioCb(vlc_object_t *access) ...@@ -124,7 +124,7 @@ static int SetupAvioCb(vlc_object_t *access)
int OpenAvio(vlc_object_t *object) int OpenAvio(vlc_object_t *object)
{ {
access_t *access = (access_t*)object; access_t *access = (access_t*)object;
access_sys_t *sys = malloc(sizeof(*sys)); access_sys_t *sys = vlc_malloc(object, sizeof(*sys));
if (!sys) if (!sys)
return VLC_ENOMEM; return VLC_ENOMEM;
sys->context = NULL; sys->context = NULL;
...@@ -140,10 +140,8 @@ int OpenAvio(vlc_object_t *object) ...@@ -140,10 +140,8 @@ int OpenAvio(vlc_object_t *object)
access->psz_location) < 0) access->psz_location) < 0)
url = NULL; url = NULL;
if (!url) { if (!url)
free(sys);
return VLC_ENOMEM; return VLC_ENOMEM;
}
/* */ /* */
vlc_init_avformat(object); vlc_init_avformat(object);
...@@ -172,7 +170,7 @@ int OpenAvio(vlc_object_t *object) ...@@ -172,7 +170,7 @@ int OpenAvio(vlc_object_t *object)
msg_Err(access, "Failed to open %s: %s", url, msg_Err(access, "Failed to open %s: %s", url,
vlc_strerror_c(AVUNERROR(ret))); vlc_strerror_c(AVUNERROR(ret)));
free(url); free(url);
goto error; return VLC_EGENERIC;
} }
free(url); free(url);
...@@ -181,7 +179,7 @@ int OpenAvio(vlc_object_t *object) ...@@ -181,7 +179,7 @@ int OpenAvio(vlc_object_t *object)
if (SetupAvioCb(VLC_OBJECT(access))) { if (SetupAvioCb(VLC_OBJECT(access))) {
msg_Err(access, "Module already in use"); msg_Err(access, "Module already in use");
avio_close(sys->context); avio_close(sys->context);
goto error; return VLC_EGENERIC;
} }
#endif #endif
...@@ -202,10 +200,6 @@ int OpenAvio(vlc_object_t *object) ...@@ -202,10 +200,6 @@ int OpenAvio(vlc_object_t *object)
access->p_sys = sys; access->p_sys = sys;
return VLC_SUCCESS; return VLC_SUCCESS;
error:
free(sys);
return VLC_EGENERIC;
} }
/* */ /* */
...@@ -221,7 +215,7 @@ int OutOpenAvio(vlc_object_t *object) ...@@ -221,7 +215,7 @@ int OutOpenAvio(vlc_object_t *object)
config_ChainParse( access, "sout-avio-", ppsz_sout_options, access->p_cfg ); config_ChainParse( access, "sout-avio-", ppsz_sout_options, access->p_cfg );
sout_access_out_sys_t *sys = malloc(sizeof(*sys)); sout_access_out_sys_t *sys = vlc_malloc(object, sizeof(*sys));
if (!sys) if (!sys)
return VLC_ENOMEM; return VLC_ENOMEM;
sys->context = NULL; sys->context = NULL;
...@@ -230,7 +224,7 @@ int OutOpenAvio(vlc_object_t *object) ...@@ -230,7 +224,7 @@ int OutOpenAvio(vlc_object_t *object)
vlc_init_avformat(object); vlc_init_avformat(object);
if (!access->psz_path) if (!access->psz_path)
goto error; return VLC_EGENERIC;
int ret; int ret;
#if LIBAVFORMAT_VERSION_MAJOR < 54 #if LIBAVFORMAT_VERSION_MAJOR < 54
...@@ -252,14 +246,14 @@ int OutOpenAvio(vlc_object_t *object) ...@@ -252,14 +246,14 @@ int OutOpenAvio(vlc_object_t *object)
if (ret < 0) { if (ret < 0) {
errno = AVUNERROR(ret); errno = AVUNERROR(ret);
msg_Err(access, "Failed to open %s", access->psz_path); msg_Err(access, "Failed to open %s", access->psz_path);
goto error; return VLC_EGENERIC;
} }
#if LIBAVFORMAT_VERSION_MAJOR < 54 #if LIBAVFORMAT_VERSION_MAJOR < 54
/* We can accept only one active user at any time */ /* We can accept only one active user at any time */
if (SetupAvioCb(VLC_OBJECT(access))) { if (SetupAvioCb(VLC_OBJECT(access))) {
msg_Err(access, "Module already in use"); msg_Err(access, "Module already in use");
goto error; return VLC_EGENERIC;
} }
#endif #endif
...@@ -269,10 +263,6 @@ int OutOpenAvio(vlc_object_t *object) ...@@ -269,10 +263,6 @@ int OutOpenAvio(vlc_object_t *object)
access->p_sys = sys; access->p_sys = sys;
return VLC_SUCCESS; return VLC_SUCCESS;
error:
free(sys);
return VLC_EGENERIC;
} }
void CloseAvio(vlc_object_t *object) void CloseAvio(vlc_object_t *object)
...@@ -285,7 +275,6 @@ void CloseAvio(vlc_object_t *object) ...@@ -285,7 +275,6 @@ void CloseAvio(vlc_object_t *object)
#endif #endif
avio_close(sys->context); avio_close(sys->context);
free(sys);
} }
void OutCloseAvio(vlc_object_t *object) void OutCloseAvio(vlc_object_t *object)
...@@ -298,7 +287,6 @@ void OutCloseAvio(vlc_object_t *object) ...@@ -298,7 +287,6 @@ void OutCloseAvio(vlc_object_t *object)
#endif #endif
avio_close(sys->context); avio_close(sys->context);
free(sys);
} }
static ssize_t Read(access_t *access, void *data, size_t size) static ssize_t Read(access_t *access, void *data, size_t size)
......
...@@ -653,7 +653,7 @@ static int blurayOpen(vlc_object_t *object) ...@@ -653,7 +653,7 @@ static int blurayOpen(vlc_object_t *object)
} }
/* */ /* */
p_demux->p_sys = p_sys = calloc(1, sizeof(*p_sys)); p_demux->p_sys = p_sys = vlc_calloc(obj, 1, sizeof(*p_sys));
if (unlikely(!p_sys)) if (unlikely(!p_sys))
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -902,7 +902,6 @@ static void blurayClose(vlc_object_t *object) ...@@ -902,7 +902,6 @@ static void blurayClose(vlc_object_t *object)
vlc_mutex_destroy(&p_sys->read_block_lock); vlc_mutex_destroy(&p_sys->read_block_lock);
free(p_sys->psz_bd_path); free(p_sys->psz_bd_path);
free(p_sys);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -223,17 +223,11 @@ static int DemuxOpen(vlc_object_t *obj) ...@@ -223,17 +223,11 @@ static int DemuxOpen(vlc_object_t *obj)
return VLC_EGENERIC; return VLC_EGENERIC;
if (track == 0 /* Whole disc -> use access plugin */) if (track == 0 /* Whole disc -> use access plugin */)
{ goto error;
ioctl_Close(obj, dev);
return VLC_EGENERIC;
}
demux_sys_t *sys = malloc(sizeof (*sys)); demux_sys_t *sys = vlc_malloc(obj, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
{ goto error;
ioctl_Close(obj, dev);
return VLC_ENOMEM;
}
demux->p_sys = sys; demux->p_sys = sys;
sys->vcddev = dev; sys->vcddev = dev;
...@@ -275,7 +269,6 @@ static int DemuxOpen(vlc_object_t *obj) ...@@ -275,7 +269,6 @@ static int DemuxOpen(vlc_object_t *obj)
error: error:
ioctl_Close(obj, dev); ioctl_Close(obj, dev);
free(sys);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -285,7 +278,6 @@ static void DemuxClose(vlc_object_t *obj) ...@@ -285,7 +278,6 @@ static void DemuxClose(vlc_object_t *obj)
demux_sys_t *sys = demux->p_sys; demux_sys_t *sys = demux->p_sys;
ioctl_Close(obj, sys->vcddev); ioctl_Close(obj, sys->vcddev);
free(sys);
} }
/***************************************************************************** /*****************************************************************************
...@@ -628,7 +620,7 @@ static int AccessOpen(vlc_object_t *obj) ...@@ -628,7 +620,7 @@ static int AccessOpen(vlc_object_t *obj)
return VLC_EGENERIC; return VLC_EGENERIC;
} }
access_sys_t *sys = malloc(sizeof (*sys)); access_sys_t *sys = vlc_malloc(obj, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
{ {
ioctl_Close(obj, dev); ioctl_Close(obj, dev);
...@@ -679,7 +671,6 @@ static int AccessOpen(vlc_object_t *obj) ...@@ -679,7 +671,6 @@ static int AccessOpen(vlc_object_t *obj)
error: error:
free(sys->p_sectors); free(sys->p_sectors);
ioctl_Close(obj, dev); ioctl_Close(obj, dev);
free(sys);
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -703,7 +694,6 @@ static void AccessClose(vlc_object_t *obj) ...@@ -703,7 +694,6 @@ static void AccessClose(vlc_object_t *obj)
free(sys->p_sectors); free(sys->p_sectors);
ioctl_Close(obj, sys->vcddev); ioctl_Close(obj, sys->vcddev);
free(sys);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -188,7 +188,7 @@ static int Open(vlc_object_t *obj) ...@@ -188,7 +188,7 @@ static int Open(vlc_object_t *obj)
if (list == NULL) if (list == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
access_sys_t *sys = malloc(sizeof (*sys)); access_sys_t *sys = vlc_malloc(obj, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
{ {
free(list); free(list);
...@@ -298,7 +298,6 @@ static void Close(vlc_object_t *obj) ...@@ -298,7 +298,6 @@ static void Close(vlc_object_t *obj)
} }
var_Destroy(access, "concat-list"); var_Destroy(access, "concat-list");
free(sys);
} }
#define INPUT_LIST_TEXT N_("Inputs list") #define INPUT_LIST_TEXT N_("Inputs list")
......
...@@ -176,7 +176,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -176,7 +176,7 @@ static int Open( vlc_object_t *p_this )
p_demux->info.i_title = 0; p_demux->info.i_title = 0;
p_demux->info.i_seekpoint = 0; p_demux->info.i_seekpoint = 0;
p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) ); p_demux->p_sys = p_sys = vlc_calloc( p_this, 1, sizeof( demux_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -201,7 +201,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -201,7 +201,6 @@ static int Open( vlc_object_t *p_this )
msg_Err( p_demux, "Bad MRL, please check the option line " msg_Err( p_demux, "Bad MRL, please check the option line "
"(MRL was: %s)", "(MRL was: %s)",
p_demux->psz_location ); p_demux->psz_location );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -209,14 +208,12 @@ static int Open( vlc_object_t *p_this ) ...@@ -209,14 +208,12 @@ static int Open( vlc_object_t *p_this )
if( !p_sys->p_dccontext ) if( !p_sys->p_dccontext )
{ {
msg_Err( p_demux, "Failed to initialise libdc1394"); msg_Err( p_demux, "Failed to initialise libdc1394");
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if( FindCamera( p_sys, p_demux ) != VLC_SUCCESS ) if( FindCamera( p_sys, p_demux ) != VLC_SUCCESS )
{ {
dc1394_free( p_sys->p_dccontext ); dc1394_free( p_sys->p_dccontext );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -224,7 +221,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -224,7 +221,6 @@ static int Open( vlc_object_t *p_this )
{ {
msg_Err( p_demux, "No camera found !!" ); msg_Err( p_demux, "No camera found !!" );
dc1394_free( p_sys->p_dccontext ); dc1394_free( p_sys->p_dccontext );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -390,7 +386,6 @@ static void Close( vlc_object_t *p_this ) ...@@ -390,7 +386,6 @@ static void Close( vlc_object_t *p_this )
dc1394_free(p_sys->p_dccontext); dc1394_free(p_sys->p_dccontext);
free( p_sys->video_device ); free( p_sys->video_device );
free( p_sys );
} }
#if 0 #if 0
......
...@@ -53,7 +53,7 @@ struct access_sys_t ...@@ -53,7 +53,7 @@ struct access_sys_t
*****************************************************************************/ *****************************************************************************/
int DirInit (access_t *access, DIR *dir) int DirInit (access_t *access, DIR *dir)
{ {
access_sys_t *sys = malloc(sizeof (*sys)); access_sys_t *sys = vlc_malloc(VLC_OBJECT(access), sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
goto error; goto error;
...@@ -77,7 +77,6 @@ int DirInit (access_t *access, DIR *dir) ...@@ -77,7 +77,6 @@ int DirInit (access_t *access, DIR *dir)
error: error:
closedir(dir); closedir(dir);
free(sys);
return VLC_ENOMEM; return VLC_ENOMEM;
} }
...@@ -108,7 +107,6 @@ void DirClose(vlc_object_t *obj) ...@@ -108,7 +107,6 @@ void DirClose(vlc_object_t *obj)
free(sys->base_uri); free(sys->base_uri);
closedir(sys->dir); closedir(sys->dir);
free(sys);
} }
int DirRead (access_t *access, input_item_node_t *node) int DirRead (access_t *access, input_item_node_t *node)
......
...@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -128,7 +128,7 @@ static int Open( vlc_object_t *p_this )
/* Set up p_access */ /* Set up p_access */
ACCESS_SET_CALLBACKS( NULL, Block, Control, NULL ); ACCESS_SET_CALLBACKS( NULL, Block, Control, NULL );
p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) ); p_access->p_sys = p_sys = vlc_malloc( p_this, sizeof( access_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -259,7 +259,6 @@ static void Close( vlc_object_t *p_this ) ...@@ -259,7 +259,6 @@ static void Close( vlc_object_t *p_this )
AVCClose( p_access ); AVCClose( p_access );
vlc_mutex_destroy( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock );
free( p_sys );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -211,7 +211,7 @@ int FileOpen( vlc_object_t *p_this ) ...@@ -211,7 +211,7 @@ int FileOpen( vlc_object_t *p_this )
#endif #endif
} }
access_sys_t *p_sys = malloc (sizeof (*p_sys)); access_sys_t *p_sys = vlc_malloc(p_this, sizeof (*p_sys));
if (unlikely(p_sys == NULL)) if (unlikely(p_sys == NULL))
goto error; goto error;
p_access->pf_read = Read; p_access->pf_read = Read;
...@@ -268,7 +268,6 @@ void FileClose (vlc_object_t * p_this) ...@@ -268,7 +268,6 @@ void FileClose (vlc_object_t * p_this)
access_sys_t *p_sys = p_access->p_sys; access_sys_t *p_sys = p_access->p_sys;
vlc_close (p_sys->fd); vlc_close (p_sys->fd);
free (p_sys);
} }
......
...@@ -669,7 +669,7 @@ static int InOpen( vlc_object_t *p_this ) ...@@ -669,7 +669,7 @@ static int InOpen( vlc_object_t *p_this )
bool b_directory; bool b_directory;
/* Init p_access */ /* Init p_access */
p_sys = p_access->p_sys = (access_sys_t*)calloc( 1, sizeof( access_sys_t ) ); p_sys = p_access->p_sys = (access_sys_t*)vlc_calloc( p_this, 1, sizeof( access_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
p_sys->data = NULL; p_sys->data = NULL;
...@@ -746,7 +746,6 @@ error: ...@@ -746,7 +746,6 @@ error:
exit_error: exit_error:
vlc_UrlClean( &p_sys->url ); vlc_UrlClean( &p_sys->url );
vlc_tls_Delete( p_sys->p_creds ); vlc_tls_Delete( p_sys->p_creds );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -756,7 +755,7 @@ static int OutOpen( vlc_object_t *p_this ) ...@@ -756,7 +755,7 @@ static int OutOpen( vlc_object_t *p_this )
sout_access_out_t *p_access = (sout_access_out_t *)p_this; sout_access_out_t *p_access = (sout_access_out_t *)p_this;
access_sys_t *p_sys; access_sys_t *p_sys;
p_sys = calloc( 1, sizeof( *p_sys ) ); p_sys = vlc_calloc( p_this, 1, sizeof( *p_sys ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -795,7 +794,6 @@ static int OutOpen( vlc_object_t *p_this ) ...@@ -795,7 +794,6 @@ static int OutOpen( vlc_object_t *p_this )
exit_error: exit_error:
vlc_UrlClean( &p_sys->url ); vlc_UrlClean( &p_sys->url );
vlc_tls_Delete( p_sys->p_creds ); vlc_tls_Delete( p_sys->p_creds );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
#endif #endif
...@@ -822,7 +820,6 @@ static void Close( vlc_object_t *p_access, access_sys_t *p_sys ) ...@@ -822,7 +820,6 @@ static void Close( vlc_object_t *p_access, access_sys_t *p_sys )
/* free memory */ /* free memory */
vlc_UrlClean( &p_sys->url ); vlc_UrlClean( &p_sys->url );
vlc_tls_Delete( p_sys->p_creds ); vlc_tls_Delete( p_sys->p_creds );
free( p_sys );
} }
static void InClose( vlc_object_t *p_this ) static void InClose( vlc_object_t *p_this )
......
...@@ -157,7 +157,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -157,7 +157,7 @@ static int Open( vlc_object_t *p_this )
int ret = VLC_EGENERIC; int ret = VLC_EGENERIC;
vlc_credential credential; vlc_credential credential;
access_sys_t *p_sys = malloc( sizeof(*p_sys) ); access_sys_t *p_sys = vlc_malloc( p_this, sizeof(*p_sys) );
if( unlikely(p_sys == NULL) ) if( unlikely(p_sys == NULL) )
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -185,7 +185,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -185,7 +185,6 @@ static int Open( vlc_object_t *p_this )
{ {
msg_Err( p_access, "invalid URL" ); msg_Err( p_access, "invalid URL" );
vlc_UrlClean( &p_sys->url ); vlc_UrlClean( &p_sys->url );
free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
if( p_sys->url.i_port <= 0 ) if( p_sys->url.i_port <= 0 )
...@@ -376,7 +375,6 @@ error: ...@@ -376,7 +375,6 @@ error:
Disconnect( p_access ); Disconnect( p_access );
free( p_sys );
return ret; return ret;
} }
...@@ -407,8 +405,6 @@ static void Close( vlc_object_t *p_this ) ...@@ -407,8 +405,6 @@ static void Close( vlc_object_t *p_this )
free( p_sys->psz_password ); free( p_sys->psz_password );
Disconnect( p_access ); Disconnect( p_access );
free( p_sys );
} }
/* Read data from the socket */ /* Read data from the socket */
......
...@@ -42,7 +42,7 @@ vlc_module_begin () ...@@ -42,7 +42,7 @@ vlc_module_begin ()
set_shortname( N_("Dummy") ) set_shortname( N_("Dummy") )
set_description( N_("Dummy input") ) set_description( N_("Dummy input") )
set_capability( "access_demux", 0 ) set_capability( "access_demux", 0 )
set_callbacks( OpenDemux, CloseDemux ) set_callbacks( OpenDemux, NULL )
add_shortcut( "dummy", "vlc" ) add_shortcut( "dummy", "vlc" )
vlc_module_end () vlc_module_end ()
...@@ -185,7 +185,7 @@ nop: ...@@ -185,7 +185,7 @@ nop:
if( length == 0 ) if( length == 0 )
goto nop; /* avoid division by zero */ goto nop; /* avoid division by zero */
demux_sys_t *p_sys = malloc( sizeof( *p_sys ) ); demux_sys_t *p_sys = vlc_malloc( p_this, sizeof( *p_sys ) );
if( p_sys == NULL ) if( p_sys == NULL )
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -202,16 +202,6 @@ nop: ...@@ -202,16 +202,6 @@ nop:
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/*****************************************************************************
* CloseDemux: initialize the target, ie. parse the command
*****************************************************************************/
static void CloseDemux( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t*)p_this;
free( p_demux->p_sys );
}
static int DemuxControl( demux_t *p_demux, int i_query, va_list args ) static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
{ {
(void)p_demux; (void)i_query; (void)args; (void)p_demux; (void)i_query; (void)args;
......
...@@ -112,7 +112,7 @@ static int Open(vlc_object_t *object) ...@@ -112,7 +112,7 @@ static int Open(vlc_object_t *object)
{ {
access_t *access = (access_t *)object; access_t *access = (access_t *)object;
access_sys_t *sys = malloc(sizeof (*sys)); access_sys_t *sys = vlc_malloc(object, sizeof (*sys));
if (unlikely(sys == NULL)) if (unlikely(sys == NULL))
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -130,11 +130,11 @@ static int Open(vlc_object_t *object) ...@@ -130,11 +130,11 @@ static int Open(vlc_object_t *object)
if (open_cb == NULL) if (open_cb == NULL)
open_cb = open_cb_default; open_cb = open_cb_default;
if (sys->read_cb == NULL) if (sys->read_cb == NULL)
goto error; <