spa: handle last_port correctly

last_port is always 1 more than the highest valid port number.
This commit is contained in:
Wim Taymans 2021-09-14 21:06:21 +02:00
parent d793086174
commit 19a3bf2100
3 changed files with 3 additions and 3 deletions

View file

@ -295,7 +295,7 @@ impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_
}
spa_memzero(port, sizeof(struct port));
if (port_id == this->last_port + 1) {
if (port_id + 1 == this->last_port) {
int i;
for (i = this->last_port - 1; i >= 0; i--)

View file

@ -292,7 +292,7 @@ impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_
}
spa_memzero(port, sizeof(struct port));
if (port_id == this->last_port - 1) {
if (port_id + 1 == this->last_port) {
int i;
for (i = this->last_port - 1; i >= 0; i--)

View file

@ -256,7 +256,7 @@ impl_node_remove_port(void *object, enum spa_direction direction, uint32_t port_
}
spa_memzero(port, sizeof(struct port));
if (port_id == this->last_port - 1) {
if (port_id + 1 == this->last_port) {
int i;
for (i = this->last_port - 1; i >= 0; i--)