Fix some leaks in error cases

This commit is contained in:
Wim Taymans 2020-05-20 14:05:42 +02:00
parent 8669fd03a6
commit c2028a1695
9 changed files with 43 additions and 22 deletions

View file

@ -442,10 +442,6 @@ static struct endpoint *create_endpoint(struct node *node, struct endpoint *moni
return NULL;
}
props = pw_properties_new(NULL, NULL);
if (props == NULL)
return NULL;
if (strstr(media_class, "Source") != NULL) {
direction = PW_DIRECTION_OUTPUT;
} else if (strstr(media_class, "Sink") != NULL) {
@ -455,6 +451,10 @@ static struct endpoint *create_endpoint(struct node *node, struct endpoint *moni
return NULL;
}
props = pw_properties_new(NULL, NULL);
if (props == NULL)
return NULL;
if (monitor != NULL) {
pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Source");
direction = PW_DIRECTION_OUTPUT;