Fix some possible-NULL pointer usage.

This commit is contained in:
Elliott Sales de Andrade 2020-11-23 03:56:57 -05:00 committed by Wim Taymans
parent 0a30eb6329
commit 86fd6a0d3e
3 changed files with 27 additions and 19 deletions

View file

@ -2382,7 +2382,7 @@ jack_client_t * jack_client_open (const char *client_name,
client = calloc(1, sizeof(struct client)); client = calloc(1, sizeof(struct client));
if (client == NULL) if (client == NULL)
goto init_failed; goto disabled;
pw_log_debug(NAME" %p: open '%s' options:%d", client, client_name, options); pw_log_debug(NAME" %p: open '%s' options:%d", client, client_name, options);

View file

@ -738,11 +738,13 @@ static void session_event_info(void *object, const struct pw_session_info *info)
i->version = PW_VERSION_SESSION_INFO; i->version = PW_VERSION_SESSION_INFO;
i->id = info->id; i->id = info->id;
} }
i->change_mask = info->change_mask; if (info) {
if (info->change_mask & PW_SESSION_CHANGE_MASK_PROPS) { i->change_mask = info->change_mask;
if (i->props) if (info->change_mask & PW_SESSION_CHANGE_MASK_PROPS) {
pw_properties_free ((struct pw_properties *)i->props); if (i->props)
i->props = (struct spa_dict *) pw_properties_new_dict (info->props); pw_properties_free ((struct pw_properties *)i->props);
i->props = (struct spa_dict *) pw_properties_new_dict (info->props);
}
} }
sess->obj.avail |= SM_SESSION_CHANGE_MASK_INFO; sess->obj.avail |= SM_SESSION_CHANGE_MASK_INFO;
@ -813,16 +815,18 @@ static void endpoint_event_info(void *object, const struct pw_endpoint_info *inf
i->direction = info->direction; i->direction = info->direction;
i->flags = info->flags; i->flags = info->flags;
} }
i->change_mask = info->change_mask; if (info) {
if (info->change_mask & PW_ENDPOINT_CHANGE_MASK_SESSION) { i->change_mask = info->change_mask;
i->session_id = info->session_id; if (info->change_mask & PW_ENDPOINT_CHANGE_MASK_SESSION) {
} i->session_id = info->session_id;
if (info->change_mask & PW_ENDPOINT_CHANGE_MASK_PROPS) { }
if (i->props) if (info->change_mask & PW_ENDPOINT_CHANGE_MASK_PROPS) {
pw_properties_free ((struct pw_properties *)i->props); if (i->props)
i->props = (struct spa_dict *) pw_properties_new_dict (info->props); pw_properties_free ((struct pw_properties *)i->props);
if ((str = spa_dict_lookup(i->props, PW_KEY_PRIORITY_SESSION)) != NULL) i->props = (struct spa_dict *) pw_properties_new_dict (info->props);
endpoint->priority = pw_properties_parse_int(str); if ((str = spa_dict_lookup(i->props, PW_KEY_PRIORITY_SESSION)) != NULL)
endpoint->priority = pw_properties_parse_int(str);
}
} }
endpoint->obj.avail |= SM_ENDPOINT_CHANGE_MASK_INFO; endpoint->obj.avail |= SM_ENDPOINT_CHANGE_MASK_INFO;
@ -907,7 +911,9 @@ static void endpoint_stream_event_info(void *object, const struct pw_endpoint_st
stream->info->endpoint_id = info->endpoint_id; stream->info->endpoint_id = info->endpoint_id;
stream->info->name = info->name ? strdup(info->name) : NULL; stream->info->name = info->name ? strdup(info->name) : NULL;
} }
stream->info->change_mask = info->change_mask; if (info) {
stream->info->change_mask = info->change_mask;
}
stream->obj.avail |= SM_ENDPOINT_CHANGE_MASK_INFO; stream->obj.avail |= SM_ENDPOINT_CHANGE_MASK_INFO;
stream->obj.changed |= SM_ENDPOINT_CHANGE_MASK_INFO; stream->obj.changed |= SM_ENDPOINT_CHANGE_MASK_INFO;
@ -984,7 +990,9 @@ static void endpoint_link_event_info(void *object, const struct pw_endpoint_link
link->info->input_endpoint_id = info->input_endpoint_id; link->info->input_endpoint_id = info->input_endpoint_id;
link->info->input_stream_id = info->input_stream_id; link->info->input_stream_id = info->input_stream_id;
} }
link->info->change_mask = info->change_mask; if (info) {
link->info->change_mask = info->change_mask;
}
link->obj.avail |= SM_ENDPOINT_LINK_CHANGE_MASK_INFO; link->obj.avail |= SM_ENDPOINT_LINK_CHANGE_MASK_INFO;
link->obj.changed |= SM_ENDPOINT_LINK_CHANGE_MASK_INFO; link->obj.changed |= SM_ENDPOINT_LINK_CHANGE_MASK_INFO;

View file

@ -387,7 +387,7 @@ handle_video_fields (ConvertData *d)
} }
value = gst_structure_get_value (d->cs, "width"); value = gst_structure_get_value (d->cs, "width");
value2 = gst_structure_get_value (d->cs, "height"); value2 = gst_structure_get_value (d->cs, "height");
if (value || value2) { if (value && value2) {
struct spa_rectangle v; struct spa_rectangle v;
for (i = 0; get_nth_rectangle (value, value2, i, &v); i++) { for (i = 0; get_nth_rectangle (value, value2, i, &v); i++) {
if (i == 0) { if (i == 0) {