Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
cc26826f
Commit
cc26826f
authored
May 31, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DBus: fix some leaks on error path (but not all)
parent
7da5f011
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
23 deletions
+14
-23
modules/control/dbus/dbus.c
modules/control/dbus/dbus.c
+14
-23
No files found.
modules/control/dbus/dbus.c
View file @
cc26826f
...
...
@@ -156,17 +156,19 @@ vlc_module_end ()
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
)
{
/* initialisation of the connection */
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
playlist_t
*
p_playlist
;
DBusConnection
*
p_conn
;
DBusError
error
;
char
*
psz_service_name
=
NULL
;
if
(
!
p_sys
||
!
dbus_threads_init_default
())
/* initialisation of the connection */
if
(
!
dbus_threads_init_default
()
)
return
VLC_EGENERIC
;
intf_sys_t
*
p_sys
=
malloc
(
sizeof
(
intf_sys_t
)
);
if
(
unlikely
(
!
p_sys
)
)
return
VLC_ENOMEM
;
playlist_t
*
p_playlist
;
DBusConnection
*
p_conn
;
p_sys
->
b_meta_read
=
false
;
p_sys
->
b_dead
=
false
;
p_sys
->
p_input
=
NULL
;
...
...
@@ -180,21 +182,15 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
}
char
psz_service_name
[
sizeof
(
DBUS_MPRIS_BUS_NAME
)
+
12
];
p_sys
->
b_unique
=
var_CreateGetBool
(
p_intf
,
"dbus-unique-service-id"
);
if
(
p_sys
->
b_unique
)
{
if
(
asprintf
(
&
psz_service_name
,
"%s-%d"
,
DBUS_MPRIS_BUS_NAME
,
getpid
()
)
<
0
)
{
free
(
p_sys
);
return
VLC_ENOMEM
;
}
}
snprintf
(
psz_service_name
,
sizeof
(
psz_service_name
),
DBUS_MPRIS_BUS_NAME
"-%d"
,
getpid
()
);
else
{
psz_service_name
=
strdup
(
DBUS_MPRIS_BUS_NAME
);
}
strcpy
(
psz_service_name
,
DBUS_MPRIS_BUS_NAME
);
DBusError
error
;
dbus_error_init
(
&
error
);
/* connect privately to the session bus
...
...
@@ -206,7 +202,6 @@ static int Open( vlc_object_t *p_this )
msg_Err
(
p_this
,
"Failed to connect to the D-Bus session daemon: %s"
,
error
.
message
);
dbus_error_free
(
&
error
);
free
(
psz_service_name
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
...
...
@@ -220,12 +215,10 @@ static int Open( vlc_object_t *p_this )
msg_Err
(
p_this
,
"Error requesting service %s: %s"
,
psz_service_name
,
error
.
message
);
dbus_error_free
(
&
error
);
free
(
psz_service_name
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
msg_Info
(
p_intf
,
"listening on dbus as: %s"
,
psz_service_name
);
free
(
psz_service_name
);
/* Register the entry point object path */
dbus_connection_register_object_path
(
p_conn
,
DBUS_MPRIS_OBJECT_PATH
,
...
...
@@ -265,7 +258,6 @@ static int Open( vlc_object_t *p_this )
p_intf
,
NULL
)
)
{
dbus_connection_unref
(
p_conn
);
free
(
psz_service_name
);
free
(
p_sys
);
return
VLC_ENOMEM
;
}
...
...
@@ -277,7 +269,6 @@ static int Open( vlc_object_t *p_this )
p_intf
,
NULL
)
)
{
dbus_connection_unref
(
p_conn
);
free
(
psz_service_name
);
free
(
p_sys
);
return
VLC_ENOMEM
;
}
...
...
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