Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
cdb07b55
Commit
cdb07b55
authored
May 09, 2008
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leaks in ncurses intf
parent
3ad6ea96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
modules/gui/ncurses.c
modules/gui/ncurses.c
+18
-14
No files found.
modules/gui/ncurses.c
View file @
cdb07b55
...
...
@@ -315,13 +315,14 @@ static int Open( vlc_object_t *p_this )
if
(
val
.
psz_string
&&
*
val
.
psz_string
)
{
p_sys
->
psz_current_dir
=
strdup
(
val
.
psz_string
);
free
(
val
.
psz_string
);
}
else
{
p_sys
->
psz_current_dir
=
strdup
(
p_intf
->
p_libvlc
->
psz_homedir
);
}
free
(
val
.
psz_string
);
p_sys
->
i_dir_entries
=
0
;
p_sys
->
pp_dir_entries
=
NULL
;
p_sys
->
b_show_hidden_files
=
false
;
...
...
@@ -337,15 +338,14 @@ static void Close( vlc_object_t *p_this )
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
int
i
;
PlaylistDestroy
(
p_intf
);
for
(
i
=
0
;
i
<
p_sys
->
i_dir_entries
;
i
++
)
while
(
p_sys
->
i_dir_entries
)
{
struct
dir_entry_t
*
p_dir_entry
=
p_sys
->
pp_dir_entries
[
i
];
struct
dir_entry_t
*
p_dir_entry
=
p_sys
->
pp_dir_entries
[
0
];
free
(
p_dir_entry
->
psz_path
);
REMOVE_ELEM
(
p_sys
->
pp_dir_entries
,
p_sys
->
i_dir_entries
,
i
);
REMOVE_ELEM
(
p_sys
->
pp_dir_entries
,
p_sys
->
i_dir_entries
,
0
);
free
(
p_dir_entry
);
}
p_sys
->
pp_dir_entries
=
NULL
;
...
...
@@ -1336,14 +1336,14 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
char
*
p_buf
=
NULL
;
int
i_len
;
if
(
w
<=
0
)
return
;
va_start
(
vl_args
,
p_fmt
);
if
(
vasprintf
(
&
p_buf
,
p_fmt
,
vl_args
)
==
-
1
)
return
;
va_end
(
vl_args
);
if
(
(
p_buf
==
NULL
)
||
(
w
<=
0
)
)
return
;
i_len
=
strlen
(
p_buf
);
#ifdef HAVE_NCURSESW
...
...
@@ -1355,8 +1355,11 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
size_t
i_width
;
/* number of columns */
if
(
i_char_len
==
(
size_t
)
-
1
)
/* an invalid character was encountered */
/* an invalid character was encountered */
{
free
(
p_buf
);
return
;
}
else
{
i_width
=
wcswidth
(
psz_wide
,
i_char_len
);
...
...
@@ -1423,6 +1426,8 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
mvprintw
(
y
,
x
,
"%s"
,
p_buf
);
mvhline
(
y
,
x
+
i_width
,
' '
,
w
-
i_width
);
}
free
(
p_buf
);
#else
if
(
i_len
>
w
)
{
...
...
@@ -2129,6 +2134,7 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh )
}
DrawBox
(
p_sys
->
w
,
y
++
,
0
,
h
,
COLS
,
psz_title
,
p_sys
->
b_color
);
free
(
psz_title
);
if
(
p_sys
->
b_need_update
||
p_sys
->
pp_plist
==
NULL
)
{
...
...
@@ -2383,17 +2389,15 @@ static void FindIndex( intf_thread_t *p_intf )
static
void
PlaylistDestroy
(
intf_thread_t
*
p_intf
)
{
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
int
i
;
for
(
i
=
0
;
i
<
p_sys
->
i_plist_entries
;
i
++
)
while
(
p_sys
->
i_plist_entries
)
{
struct
pl_item_t
*
p_pl_item
=
p_sys
->
pp_plist
[
i
];
struct
pl_item_t
*
p_pl_item
=
p_sys
->
pp_plist
[
0
];
free
(
p_pl_item
->
psz_display
);
REMOVE_ELEM
(
p_sys
->
pp_plist
,
p_sys
->
i_plist_entries
,
i
);
REMOVE_ELEM
(
p_sys
->
pp_plist
,
p_sys
->
i_plist_entries
,
0
);
free
(
p_pl_item
);
}
p_sys
->
pp_plist
=
NULL
;
p_sys
->
i_plist_entries
=
0
;
}
static
void
Eject
(
intf_thread_t
*
p_intf
)
...
...
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