Le 27 mai 2015 10:53 AM, "Juri Lelli" <juri.lelli@arm.com> a écrit :
>
> Hi,
>
> On 05/13/2015 04:32 AM, pi-cheng.chen wrote:
> > From: Vincent Guittot <vincent.guittot@linaro.org>
> >
> > futhermore, some object are used several times
> >
> > Vincent Guittot <vincent.guittot@linaro.org>
> > ---
> > src/rt-app_parse_config.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c
> > index fc404d6..33ea783 100644
> > --- a/src/rt-app_parse_config.c
> > +++ b/src/rt-app_parse_config.c
> > @@ -120,7 +120,6 @@ get_int_value_from(struct json_object *where,
> > set_default_if_needed(key, value, have_def, def_value);
> > assure_type_is(value, where, key, json_type_int);
> > i_value = json_object_get_int(value);
> > - json_object_put(value);
> > log_info(PIN "key: %s, value: %d, type <int>", key, i_value);
> > return i_value;
> > }
> > @@ -137,7 +136,6 @@ get_bool_value_from(struct json_object *where,
> > set_default_if_needed(key, value, have_def, def_value);
> > assure_type_is(value, where, key, json_type_boolean);
> > b_value = json_object_get_boolean(value);
> > - json_object_put(value);
> > log_info(PIN "key: %s, value: %d, type <bool>", key, b_value);
> > return b_value;
> > }
> > @@ -158,7 +156,6 @@ get_string_value_from(struct json_object *where,
> > }
> > assure_type_is(value, where, key, json_type_string);
> > s_value = strdup(json_object_get_string(value));
> > - json_object_put(value);
> > log_info(PIN "key: %s, value: %s, type <string>", key, s_value);
> > return s_value;
> > }
> > @@ -508,6 +505,7 @@ get_opts_from_json_object(struct json_object *root, rtapp_options_t *opts)
> > parse_global(global, opts);
> > parse_resources(resources, opts);
> > parse_tasks(tasks, opts);
> > + json_object_put(tasks);
>
> Why is this needed here (and not for global and resources too) ?
IIRC, There are several patches around ref count and memory management of json object. This patch fixes some issues for tasks object and the others objects are solved by other patches
Regards,
Vincent
>
> Thanks,
>
> - Juri
>
> >
> > }
> >
> >
>