diff mbox

[ndctl] ndctl: remove a double put in injection status json

Message ID 20180201004938.19823-1-vishal.l.verma@intel.com (mailing list archive)
State Accepted
Commit 5c712d4031c5
Headers show

Commit Message

Verma, Vishal L Feb. 1, 2018, 12:49 a.m. UTC
newer json-c catches a double put of the json object in printing the
injection status. We only need to put the containing jobj.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/inject-error.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Dan Williams Feb. 1, 2018, 12:57 a.m. UTC | #1
On Wed, Jan 31, 2018 at 4:49 PM, Vishal Verma <vishal.l.verma@intel.com> wrote:
> newer json-c catches a double put of the json object in printing the
> injection status. We only need to put the containing jobj.
>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
>  ndctl/inject-error.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/ndctl/inject-error.c b/ndctl/inject-error.c
> index 374ae0b..9b9d821 100644
> --- a/ndctl/inject-error.c
> +++ b/ndctl/inject-error.c
> @@ -263,8 +263,6 @@ static int injection_status(struct ndctl_namespace *ndns)
>                 printf("%s\n", json_object_to_json_string_ext(jobj,
>                         JSON_C_TO_STRING_PRETTY));
>         }
> -
> -       json_object_put(jbbs);
>         json_object_put(jobj);

Yeah, once you link an object to a container you only need to put that
parent object. Looks good to me.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
diff mbox

Patch

diff --git a/ndctl/inject-error.c b/ndctl/inject-error.c
index 374ae0b..9b9d821 100644
--- a/ndctl/inject-error.c
+++ b/ndctl/inject-error.c
@@ -263,8 +263,6 @@  static int injection_status(struct ndctl_namespace *ndns)
 		printf("%s\n", json_object_to_json_string_ext(jobj,
 			JSON_C_TO_STRING_PRETTY));
 	}
-
-	json_object_put(jbbs);
 	json_object_put(jobj);
 
 	return rc;