mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-02 07:15:38 -04:00
properties: Fix memory leak
Do not initialize changes in update_string() if spa_json_begin_object_relax() fails to avoid having to clear changes before returning.
This commit is contained in:
parent
d8f0cc7817
commit
648badb427
1 changed files with 3 additions and 3 deletions
|
|
@ -218,12 +218,12 @@ static int update_string(struct pw_properties *props, const char *str, size_t si
|
||||||
struct properties changes;
|
struct properties changes;
|
||||||
const char *value;
|
const char *value;
|
||||||
|
|
||||||
if (props)
|
|
||||||
properties_init(&changes, 16);
|
|
||||||
|
|
||||||
if ((res = spa_json_begin_object_relax(&it[0], str, size)) <= 0)
|
if ((res = spa_json_begin_object_relax(&it[0], str, size)) <= 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
if (props)
|
||||||
|
properties_init(&changes, 16);
|
||||||
|
|
||||||
while ((len = spa_json_object_next(&it[0], key, sizeof(key), &value)) > 0) {
|
while ((len = spa_json_object_next(&it[0], key, sizeof(key), &value)) > 0) {
|
||||||
char *val = NULL;
|
char *val = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue