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));
if (client == NULL)
goto init_failed;
goto disabled;
pw_log_debug(NAME" %p: open '%s' options:%d", client, client_name, options);

View file

@ -738,12 +738,14 @@ static void session_event_info(void *object, const struct pw_session_info *info)
i->version = PW_VERSION_SESSION_INFO;
i->id = info->id;
}
if (info) {
i->change_mask = info->change_mask;
if (info->change_mask & PW_SESSION_CHANGE_MASK_PROPS) {
if (i->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.changed |= SM_SESSION_CHANGE_MASK_INFO;
@ -813,6 +815,7 @@ static void endpoint_event_info(void *object, const struct pw_endpoint_info *inf
i->direction = info->direction;
i->flags = info->flags;
}
if (info) {
i->change_mask = info->change_mask;
if (info->change_mask & PW_ENDPOINT_CHANGE_MASK_SESSION) {
i->session_id = info->session_id;
@ -824,6 +827,7 @@ static void endpoint_event_info(void *object, const struct pw_endpoint_info *inf
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.changed |= 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->name = info->name ? strdup(info->name) : NULL;
}
if (info) {
stream->info->change_mask = info->change_mask;
}
stream->obj.avail |= 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_stream_id = info->input_stream_id;
}
if (info) {
link->info->change_mask = info->change_mask;
}
link->obj.avail |= 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");
value2 = gst_structure_get_value (d->cs, "height");
if (value || value2) {
if (value && value2) {
struct spa_rectangle v;
for (i = 0; get_nth_rectangle (value, value2, i, &v); i++) {
if (i == 0) {