aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/libacron/private/serializer.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/client/libacron/private/serializer.c b/client/libacron/private/serializer.c
index c5b1b17..3517fc2 100644
--- a/client/libacron/private/serializer.c
+++ b/client/libacron/private/serializer.c
@@ -237,9 +237,6 @@ static int deserialize_response(json_object *obj, const char *type_str, const in
}
return AC_E_OK;
fail:
- if (obj) {
- json_object_put(obj);
- }
return r;
}
@@ -373,9 +370,6 @@ static int deserialize_event(json_object *obj, const char *type_str, ac_event_t
return AC_E_OK;
fail:
- if (obj) {
- json_object_put(obj);
- }
return r;
}
@@ -398,10 +392,12 @@ int deserialize(const char *string, unsigned int len, ac_obj_t **out) {
}
if (has_id) {
- return deserialize_response(obj, type_str, id, (ac_response_t **) out);
+ r = deserialize_response(obj, type_str, id, (ac_response_t **) out);
} else {
- return deserialize_event(obj, type_str, (ac_event_t **) out);
+ r = deserialize_event(obj, type_str, (ac_event_t **) out);
}
+ json_object_put(obj);
+ return r;
}
static int json_add(json_object *obj, const char *key, json_object *val) {