mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
format: Don't _put() objects obtained with json_object_object_get() or json_object_array_get_idx()
json-c documentation states that "No reference counts will be changed. There is no need to manually adjust reference counts through the json_object_put/json_object_get methods unless..." hence fix pa_format_info_get_prop_type() and pa_format_info_get_prop_int_range(); note that pa_format_info_prop_compatible() is OK the json_object_array_get_idx() bug reported by Arun, thanks! Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Cc: Arun Raghavan <arun@accosted.net>
This commit is contained in:
parent
6d88a139fc
commit
514766a79f
1 changed files with 0 additions and 9 deletions
|
|
@ -278,7 +278,6 @@ pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char
|
||||||
else
|
else
|
||||||
type = PA_PROP_TYPE_INVALID;
|
type = PA_PROP_TYPE_INVALID;
|
||||||
|
|
||||||
json_object_put(o1);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case json_type_object:
|
case json_type_object:
|
||||||
|
|
@ -289,14 +288,12 @@ pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char
|
||||||
type = PA_PROP_TYPE_INVALID;
|
type = PA_PROP_TYPE_INVALID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
json_object_put(o1);
|
|
||||||
|
|
||||||
o1 = json_object_object_get(o, PA_JSON_MAX_KEY);
|
o1 = json_object_object_get(o, PA_JSON_MAX_KEY);
|
||||||
if (!o1) {
|
if (!o1) {
|
||||||
type = PA_PROP_TYPE_INVALID;
|
type = PA_PROP_TYPE_INVALID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
json_object_put(o1);
|
|
||||||
|
|
||||||
type = PA_PROP_TYPE_INT_RANGE;
|
type = PA_PROP_TYPE_INT_RANGE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -367,13 +364,11 @@ int pa_format_info_get_prop_int_range(const pa_format_info *f, const char *key,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
*min = json_object_get_int(o1);
|
*min = json_object_get_int(o1);
|
||||||
json_object_put(o1);
|
|
||||||
|
|
||||||
if (!(o1 = json_object_object_get(o, PA_JSON_MAX_KEY)))
|
if (!(o1 = json_object_object_get(o, PA_JSON_MAX_KEY)))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
*max = json_object_get_int(o1);
|
*max = json_object_get_int(o1);
|
||||||
json_object_put(o1);
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
|
@ -415,12 +410,10 @@ int pa_format_info_get_prop_int_array(const pa_format_info *f, const char *key,
|
||||||
o1 = json_object_array_get_idx(o, i);
|
o1 = json_object_array_get_idx(o, i);
|
||||||
|
|
||||||
if (json_object_get_type(o1) != json_type_int) {
|
if (json_object_get_type(o1) != json_type_int) {
|
||||||
json_object_put(o1);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*values)[i] = json_object_get_int(o1);
|
(*values)[i] = json_object_get_int(o1);
|
||||||
json_object_put(o1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
@ -493,12 +486,10 @@ int pa_format_info_get_prop_string_array(const pa_format_info *f, const char *ke
|
||||||
o1 = json_object_array_get_idx(o, i);
|
o1 = json_object_array_get_idx(o, i);
|
||||||
|
|
||||||
if (json_object_get_type(o1) != json_type_string) {
|
if (json_object_get_type(o1) != json_type_string) {
|
||||||
json_object_put(o1);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*values)[i] = pa_xstrdup(json_object_get_string(o1));
|
(*values)[i] = pa_xstrdup(json_object_get_string(o1));
|
||||||
json_object_put(o1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue