Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
92b7fde9
Commit
92b7fde9
authored
Aug 07, 2011
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbus: allocate pollfd array on the stack
fix memleak when thread is cancelled
parent
f745f60c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
modules/control/dbus/dbus.c
modules/control/dbus/dbus.c
+7
-10
No files found.
modules/control/dbus/dbus.c
View file @
92b7fde9
...
...
@@ -113,7 +113,6 @@ static void watch_toggled ( DBusWatch *p_watch, void *p_data );
static
void
wakeup_main_loop
(
void
*
p_data
);
static
int
GetPollFds
(
intf_thread_t
*
p_intf
,
struct
pollfd
*
p_fds
);
static
int
UpdateTimeouts
(
intf_thread_t
*
p_intf
,
mtime_t
i_lastrun
);
static
void
ProcessEvents
(
intf_thread_t
*
p_intf
,
...
...
@@ -835,9 +834,10 @@ static void Run ( intf_thread_t *p_intf )
vlc_mutex_lock
(
&
p_sys
->
lock
);
int
i_watches
=
vlc_array_count
(
p_sys
->
p_watches
);
struct
pollfd
*
p_fds
=
calloc
(
i_watches
,
sizeof
(
struct
pollfd
)
);
struct
pollfd
fds
[
i_watches
];
memset
(
fds
,
0
,
sizeof
fds
);
int
i_fds
=
GetPollFds
(
p_intf
,
p_
fds
);
int
i_fds
=
GetPollFds
(
p_intf
,
fds
);
mtime_t
i_now
=
mdate
(),
i_loop_interval
=
i_now
-
i_last_run
;
...
...
@@ -857,7 +857,7 @@ static void Run ( intf_thread_t *p_intf )
/* thread cancellation is allowed while the main loop sleeps */
vlc_restorecancel
(
canc
);
int
i_pollres
=
poll
(
p_
fds
,
i_fds
,
i_next_timeout
);
int
i_pollres
=
poll
(
fds
,
i_fds
,
i_next_timeout
);
int
i_errsv
=
errno
;
canc
=
vlc_savecancel
();
...
...
@@ -867,17 +867,16 @@ static void Run ( intf_thread_t *p_intf )
if
(
-
1
==
i_pollres
)
{
/* XXX: What should we do when poll() fails ? */
msg_Err
(
p_intf
,
"poll() failed: %m"
);
free
(
p_fds
);
p_fds
=
NULL
;
vlc_restorecancel
(
canc
);
continue
;
}
/* Was the main loop woken up manually ? */
if
(
0
<
i_pollres
&&
(
p_
fds
[
0
].
revents
&
POLLIN
)
)
if
(
0
<
i_pollres
&&
(
fds
[
0
].
revents
&
POLLIN
)
)
{
char
buf
;
msg_Dbg
(
p_intf
,
"Removing a byte from the self-pipe"
);
(
void
)
read
(
p_
fds
[
0
].
fd
,
&
buf
,
1
);
(
void
)
read
(
fds
[
0
].
fd
,
&
buf
,
1
);
}
/* We need to lock the mutex while building lists of events,
...
...
@@ -920,9 +919,7 @@ static void Run ( intf_thread_t *p_intf )
vlc_mutex_unlock
(
&
p_intf
->
p_sys
->
lock
);
ProcessEvents
(
p_intf
,
p_info
,
i_events
);
ProcessWatches
(
p_intf
,
p_watches
,
i_watches
,
p_fds
,
i_fds
);
free
(
p_fds
);
p_fds
=
NULL
;
ProcessWatches
(
p_intf
,
p_watches
,
i_watches
,
fds
,
i_fds
);
ProcessTimeouts
(
p_intf
,
p_timeouts
,
i_timeouts
);
DispatchDBusMessages
(
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