Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
4ae90d8f
Commit
4ae90d8f
authored
Nov 25, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all: fixed a lot of small memory leaks.
parent
89fd537f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
58 deletions
+98
-58
modules/demux/util/id3tag.c
modules/demux/util/id3tag.c
+31
-25
src/input/input_programs.c
src/input/input_programs.c
+4
-1
src/libvlc.c
src/libvlc.c
+8
-2
src/playlist/group.c
src/playlist/group.c
+16
-11
src/playlist/item.c
src/playlist/item.c
+27
-17
src/playlist/playlist.c
src/playlist/playlist.c
+12
-2
No files found.
modules/demux/util/id3tag.c
View file @
4ae90d8f
...
...
@@ -2,7 +2,7 @@
* id3tag.c: id3 tag parser/skipper based on libid3tag
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: id3tag.c,v 1.1
5 2003/11/02 22:15:14 gbazin
Exp $
* $Id: id3tag.c,v 1.1
6 2003/11/25 00:56:34 fenrir
Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
...
...
@@ -61,23 +61,23 @@ vlc_module_end();
*****************************************************************************/
static
void
ParseID3Tag
(
input_thread_t
*
p_input
,
uint8_t
*
p_data
,
int
i_size
)
{
playlist_t
*
p_playlist
;
struct
id3_tag
*
p_id3_tag
;
struct
id3_frame
*
p_frame
;
input_info_category_t
*
p_category
;
int
i_strings
;
char
*
psz_temp
;
int
i
;
playlist_t
*
p_playlist
;
struct
id3_tag
*
p_id3_tag
;
struct
id3_frame
*
p_frame
;
input_info_category_t
*
p_category
;
char
*
psz_temp
;
vlc_value_t
val
;
int
i
;
var_Get
(
p_input
,
"demuxed-id3"
,
&
val
);
if
(
val
.
b_bool
)
{
msg_Dbg
(
p_input
,
"The ID3 tag was already parsed"
);
return
;
}
p_playlist
=
vlc_object_find
(
p_input
,
VLC_OBJECT_PLAYLIST
,
FIND_PARENT
);
val
.
b_bool
=
VLC_FALSE
;
p_id3_tag
=
id3_tag_parse
(
p_data
,
i_size
);
p_category
=
input_InfoCategory
(
p_input
,
"ID3"
);
...
...
@@ -85,7 +85,9 @@ static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
while
(
(
p_frame
=
id3_tag_findframe
(
p_id3_tag
,
"T"
,
i
)
)
)
{
i_strings
=
id3_field_getnstrings
(
&
p_frame
->
fields
[
1
]
);
playlist_item_t
*
p_item
=
p_playlist
?
p_playlist
->
pp_items
[
p_playlist
->
i_index
]
:
NULL
;
int
i_strings
=
id3_field_getnstrings
(
&
p_frame
->
fields
[
1
]
);
while
(
i_strings
>
0
)
{
psz_temp
=
id3_ucs4_utf8duplicate
(
id3_field_getstrings
(
&
p_frame
->
fields
[
1
],
--
i_strings
)
);
...
...
@@ -107,28 +109,30 @@ static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
}
else
if
(
!
strcmp
(
p_frame
->
id
,
ID3_FRAME_TITLE
)
)
{
p_playlist
=
vlc_object_find
(
p_input
,
VLC_OBJECT_PLAYLIST
,
FIND_PARENT
);
if
(
p_playlist
)
if
(
p_item
)
{
p_playlist
->
pp_items
[
p_playlist
->
i_index
]
->
psz_name
=
strdup
(
psz_temp
);
if
(
p_item
->
psz_name
)
{
free
(
p_item
->
psz_name
);
}
p_item
->
psz_name
=
strdup
(
psz_temp
);;
val
.
b_bool
=
VLC_TRUE
;
vlc_object_release
(
p_playlist
);
}
input_AddInfo
(
p_category
,
(
char
*
)
p_frame
->
description
,
psz_temp
);
}
else
if
(
!
strcmp
(
p_frame
->
id
,
ID3_FRAME_ARTIST
)
)
{
p_playlist
=
vlc_object_find
(
p_input
,
VLC_OBJECT_PLAYLIST
,
FIND_PARENT
);
if
(
p_playlist
)
if
(
p_item
)
{
p_playlist
->
pp_items
[
p_playlist
->
i_index
]
->
psz_author
=
strdup
(
psz_temp
);
if
(
p_item
->
psz_author
)
{
free
(
p_item
->
psz_author
);
}
p_item
->
psz_author
=
strdup
(
psz_temp
);
val
.
b_bool
=
VLC_TRUE
;
vlc_object_release
(
p_playlist
);
}
input_AddInfo
(
p_category
,
(
char
*
)
p_frame
->
description
,
psz_temp
);
...
...
@@ -145,17 +149,19 @@ static void ParseID3Tag( input_thread_t *p_input, uint8_t *p_data, int i_size )
id3_tag_delete
(
p_id3_tag
);
if
(
val
.
b_bool
==
VLC_TRUE
)
{
p_playlist
=
vlc_object_find
(
p_input
,
VLC_OBJECT_PLAYLIST
,
FIND_PARENT
);
if
(
p_playlist
)
{
val
.
b_bool
=
VLC_TRUE
;
var_Set
(
p_playlist
,
"intf-change"
,
val
);
vlc_object_release
(
p_playlist
);
}
}
val
.
b_bool
=
VLC_TRUE
;
var_Change
(
p_input
,
"demuxed-id3"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
);
if
(
p_playlist
)
{
vlc_object_release
(
p_playlist
);
}
}
/*****************************************************************************
...
...
src/input/input_programs.c
View file @
4ae90d8f
...
...
@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management
*****************************************************************************
* Copyright (C) 1999-2002 VideoLAN
* $Id: input_programs.c,v 1.12
3 2003/11/24 03:27:28 rocky
Exp $
* $Id: input_programs.c,v 1.12
4 2003/11/25 00:56:35 fenrir
Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
...
...
@@ -376,6 +376,7 @@ input_area_t * input_AddArea( input_thread_t * p_input,
}
if
(
text2
.
psz_string
)
free
(
text2
.
psz_string
);
free
(
val
.
psz_string
);
}
if
(
p_input
->
stream
.
i_area_nb
==
2
)
...
...
@@ -544,6 +545,8 @@ void input_DelArea( input_thread_t * p_input, input_area_t * p_area )
sprintf
(
val
.
psz_string
,
"title %i"
,
p_area
->
i_id
);
var_Change
(
p_input
,
"navigation"
,
VLC_VAR_DELCHOICE
,
&
val
,
NULL
);
var_Destroy
(
p_input
,
val
.
psz_string
);
free
(
val
.
psz_string
);
}
/* Remove this area from the stream's list of areas */
...
...
src/libvlc.c
View file @
4ae90d8f
...
...
@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.10
2 2003/11/23 18:31:55 alexis
Exp $
* $Id: libvlc.c,v 1.10
3 2003/11/25 00:56:34 fenrir
Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
...
...
@@ -569,7 +569,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
var_Create
(
p_vlc
,
"key-pressed"
,
VLC_VAR_INTEGER
);
p_vlc
->
p_hotkeys
=
malloc
(
sizeof
(
p_hotkeys
)
);
/* Do a copy (we don't need to modify the strings) */
p_vlc
->
p_hotkeys
=
p_hotkeys
;
memcpy
(
p_vlc
->
p_hotkeys
,
p_hotkeys
,
sizeof
(
p_hotkeys
)
)
;
/*
* Initialize playlist and get commandline files
...
...
@@ -725,6 +725,12 @@ int VLC_Destroy( int i_object )
p_vlc
->
psz_configfile
=
NULL
;
}
if
(
p_vlc
->
p_hotkeys
)
{
free
(
p_vlc
->
p_hotkeys
);
p_vlc
->
p_hotkeys
=
NULL
;
}
/*
* XXX: Free module bank !
*/
...
...
src/playlist/group.c
View file @
4ae90d8f
...
...
@@ -2,7 +2,7 @@
* playlist.c : Playlist groups management functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: group.c,v 1.
2 2003/11/12 08:10:21 zorglub
Exp $
* $Id: group.c,v 1.
3 2003/11/25 00:56:35 fenrir
Exp $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
...
...
@@ -42,11 +42,11 @@
playlist_group_t
*
playlist_CreateGroup
(
playlist_t
*
p_playlist
,
char
*
psz_name
)
{
playlist_group_t
*
p_group
;
int
i
;
for
(
i
=
0
;
i
<
p_playlist
->
i_groups
;
i
++
)
for
(
i
=
0
;
i
<
p_playlist
->
i_groups
;
i
++
)
{
if
(
!
strcasecmp
(
p_playlist
->
pp_groups
[
i
]
->
psz_name
,
psz_name
)
)
if
(
!
strcasecmp
(
p_playlist
->
pp_groups
[
i
]
->
psz_name
,
psz_name
)
)
{
msg_Info
(
p_playlist
,
"This group already exists !"
);
return
NULL
;
...
...
@@ -54,8 +54,7 @@ playlist_group_t * playlist_CreateGroup(playlist_t * p_playlist, char *psz_name)
}
/* Allocate the group structure */
p_group
=
(
playlist_group_t
*
)
malloc
(
sizeof
(
playlist_group_t
)
);
if
(
!
p_group
)
if
(
(
p_group
=
malloc
(
sizeof
(
playlist_group_t
)
)
)
==
NULL
)
{
msg_Err
(
p_playlist
,
"out of memory"
);
return
NULL
;
...
...
@@ -90,18 +89,24 @@ int playlist_DeleteGroup( playlist_t *p_playlist, int i_id )
for
(
i
=
0
;
i
<=
p_playlist
->
i_groups
;
i
++
)
{
if
(
p_playlist
->
pp_groups
[
i
]
->
i_id
==
i_id
)
playlist_group_t
*
p_group
=
p_playlist
->
pp_groups
[
i
];
if
(
p_group
->
i_id
==
i_id
)
{
if
(
p_playlist
->
pp_groups
[
i
]
->
psz_name
)
if
(
p_group
->
psz_name
)
{
free
(
p_
playlist
->
pp_groups
[
i
]
->
psz_name
);
free
(
p_
group
->
psz_name
);
}
REMOVE_ELEM
(
p_playlist
->
pp_groups
,
p_playlist
->
i_groups
,
i
);
i
);
free
(
p_group
);
return
VLC_SUCCESS
;
}
}
return
0
;
return
VLC_SUCCESS
;
}
/**
...
...
src/playlist/item.c
View file @
4ae90d8f
...
...
@@ -2,7 +2,7 @@
* item.c : Playlist item functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: item.c,v 1.
3 2003/11/23 16:24:20 garf
Exp $
* $Id: item.c,v 1.
4 2003/11/25 00:56:35 fenrir
Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
...
...
@@ -75,7 +75,7 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
p_item
->
psz_name
=
strdup
(
psz_name
);
p_item
->
psz_uri
=
strdup
(
psz_uri
);
p_item
->
psz_author
=
strdup
(
""
);
p_item
->
psz_author
=
strdup
(
"
Arg
"
);
p_item
->
i_duration
=
i_duration
;
p_item
->
i_type
=
0
;
p_item
->
i_status
=
0
;
...
...
@@ -86,13 +86,15 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
p_item
->
ppsz_options
=
NULL
;
p_item
->
i_options
=
i_options
;
if
(
i_options
)
if
(
i_options
>
0
)
{
int
i
;
p_item
->
ppsz_options
=
(
char
**
)
malloc
(
i_options
*
sizeof
(
char
*
)
);
p_item
->
ppsz_options
=
malloc
(
i_options
*
sizeof
(
char
*
)
);
for
(
i
=
0
;
i
<
i_options
;
i
++
)
{
p_item
->
ppsz_options
[
i
]
=
strdup
(
ppsz_options
[
i
]
);
}
}
...
...
@@ -220,6 +222,10 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
{
free
(
p_playlist
->
pp_items
[
i_pos
]
->
psz_uri
);
}
if
(
p_playlist
->
pp_items
[
i_pos
]
->
psz_author
)
{
free
(
p_playlist
->
pp_items
[
i_pos
]
->
psz_author
);
}
/* XXX: what if the item is still in use? */
free
(
p_playlist
->
pp_items
[
i_pos
]
);
p_playlist
->
pp_items
[
i_pos
]
=
p_item
;
...
...
@@ -253,7 +259,6 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t * p_item,
int
playlist_Delete
(
playlist_t
*
p_playlist
,
int
i_pos
)
{
vlc_value_t
val
;
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
/* if i_pos is the current played item, playlist should stop playing it */
if
(
(
p_playlist
->
i_status
==
PLAYLIST_RUNNING
)
&&
(
p_playlist
->
i_index
==
i_pos
)
)
...
...
@@ -261,35 +266,40 @@ int playlist_Delete( playlist_t * p_playlist, int i_pos )
playlist_Command
(
p_playlist
,
PLAYLIST_STOP
,
0
);
}
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
if
(
i_pos
>=
0
&&
i_pos
<
p_playlist
->
i_size
)
{
playlist_item_t
*
p_item
=
p_playlist
->
pp_items
[
i_pos
];
msg_Dbg
(
p_playlist
,
"deleting playlist item %s "
,
p_playlist
->
pp_items
[
i_pos
]
->
psz_name
);
p_item
->
psz_name
);
if
(
p_
playlist
->
pp_items
[
i_pos
]
->
psz_name
)
if
(
p_
item
->
psz_name
)
{
free
(
p_
playlist
->
pp_items
[
i_pos
]
->
psz_name
);
free
(
p_
item
->
psz_name
);
}
if
(
p_
playlist
->
pp_items
[
i_pos
]
->
psz_uri
)
if
(
p_
item
->
psz_uri
)
{
free
(
p_
playlist
->
pp_items
[
i_pos
]
->
psz_uri
);
free
(
p_
item
->
psz_uri
);
}
if
(
p_
playlist
->
pp_items
[
i_pos
]
->
psz_author
)
if
(
p_
item
->
psz_author
)
{
free
(
p_
playlist
->
pp_items
[
i_pos
]
->
psz_author
);
free
(
p_
item
->
psz_author
);
}
if
(
p_
playlist
->
pp_items
[
i_pos
]
->
i_options
)
if
(
p_
item
->
i_options
>
0
)
{
int
i
;
for
(
i
=
0
;
i
<
p_playlist
->
pp_items
[
i_pos
]
->
i_options
;
i
++
)
free
(
p_playlist
->
pp_items
[
i_pos
]
->
ppsz_options
[
i
]
);
for
(
i
=
0
;
i
<
p_item
->
i_options
;
i
++
)
{
free
(
p_item
->
ppsz_options
[
i
]
);
}
free
(
p_
playlist
->
pp_items
[
i_pos
]
->
ppsz_options
);
free
(
p_
item
->
ppsz_options
);
}
/* XXX: what if the item is still in use? */
free
(
p_
playlist
->
pp_items
[
i_pos
]
);
free
(
p_
item
);
if
(
i_pos
<=
p_playlist
->
i_index
)
{
...
...
src/playlist/playlist.c
View file @
4ae90d8f
...
...
@@ -2,7 +2,7 @@
* playlist.c : Playlist management functions
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: playlist.c,v 1.6
4 2003/11/14 03:51:39 hartman
Exp $
* $Id: playlist.c,v 1.6
5 2003/11/25 00:56:35 fenrir
Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
...
...
@@ -89,7 +89,7 @@ playlist_t * __playlist_Create ( vlc_object_t *p_parent )
p_playlist
->
pp_groups
=
NULL
;
p_playlist
->
i_max_id
=
0
;
playlist_CreateGroup
(
p_playlist
,
strdup
(
"Normal"
)
);
playlist_CreateGroup
(
p_playlist
,
"Normal"
);
if
(
vlc_thread_create
(
p_playlist
,
"playlist"
,
RunThread
,
VLC_THREAD_PRIORITY_LOW
,
VLC_TRUE
)
)
...
...
@@ -119,6 +119,16 @@ void playlist_Destroy( playlist_t * p_playlist )
var_Destroy
(
p_playlist
,
"intf-change"
);
while
(
p_playlist
->
i_groups
>
0
)
{
playlist_DeleteGroup
(
p_playlist
,
p_playlist
->
pp_groups
[
0
]
->
i_id
);
}
while
(
p_playlist
->
i_size
>
0
)
{
playlist_Delete
(
p_playlist
,
0
);
}
vlc_object_destroy
(
p_playlist
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment