media-session: avoid some segfaults

This commit is contained in:
Wim Taymans 2020-01-16 16:19:09 +01:00
parent ae51b0acf1
commit 6af00219e1
2 changed files with 6 additions and 0 deletions

View file

@ -1696,8 +1696,12 @@ int main(int argc, char *argv[])
pw_init(&argc, &argv);
impl.loop = pw_main_loop_new(NULL);
if (impl.loop == NULL)
return -1;
impl.this.loop = pw_main_loop_get_loop(impl.loop);
impl.this.context = pw_context_new(impl.this.loop, NULL, 0);
if (impl.this.context == NULL)
return -1;
pw_context_add_spa_lib(impl.this.context, "api.bluez5.*", "bluez5/libspa-bluez5");
pw_context_add_spa_lib(impl.this.context, "api.alsa.*", "alsa/libspa-alsa");

View file

@ -448,6 +448,8 @@ static int rescan_node(struct impl *impl, struct node *n)
if ((obj = sm_media_session_find_object(impl->session, path_id)) != NULL) {
if (strcmp(obj->type, PW_TYPE_INTERFACE_Node) == 0) {
peer = sm_object_get_data(obj, SESSION_KEY);
if (peer == NULL)
return -ENOENT;
goto do_link;
}
}