[pulseaudio-discuss] [PATCH 1/4] format: Don't _put() objects obtained with json_object_object_get()

Peter Meerwald pmeerw at pmeerw.net
Mon Aug 18 05:47:24 PDT 2014


From: Peter Meerwald <p.meerwald at bct-electronic.com>

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

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/pulse/format.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/pulse/format.c b/src/pulse/format.c
index 729c2d2..a61ba37 100644
--- a/src/pulse/format.c
+++ b/src/pulse/format.c
@@ -289,14 +289,12 @@ pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char
                 type = PA_PROP_TYPE_INVALID;
                 break;
             }
-            json_object_put(o1);
 
             o1 = json_object_object_get(o, PA_JSON_MAX_KEY);
             if (!o1) {
                 type = PA_PROP_TYPE_INVALID;
                 break;
             }
-            json_object_put(o1);
 
             type = PA_PROP_TYPE_INT_RANGE;
             break;
@@ -367,13 +365,11 @@ int pa_format_info_get_prop_int_range(const pa_format_info *f, const char *key,
         goto out;
 
     *min = json_object_get_int(o1);
-    json_object_put(o1);
 
     if (!(o1 = json_object_object_get(o, PA_JSON_MAX_KEY)))
         goto out;
 
     *max = json_object_get_int(o1);
-    json_object_put(o1);
 
     ret = 0;
 
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list