From: Steve Scargall <steve.scarg...@intel.com> Current versions of the json-c library abort when decrementing an object reference past 0. Given that util_display_json_array() drops the reference to the passed in object we do not need to drop the reference in dimm_action(). This fixes failures with the following signature:
$ ndctl read-labels nmem0 nmem1 -j ... ndctl: json_object.c:159: json_object_put: Assertion `jso->_ref_count > 0' failed. Aborted (core dumped) Signed-off-by: Steve Scargall <steve.scarg...@intel.com> Signed-off-by: Dan Williams <dan.j.willi...@intel.com> --- ndctl/dimm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ndctl/dimm.c b/ndctl/dimm.c index f51f34bb28b6..1c168997105e 100644 --- a/ndctl/dimm.c +++ b/ndctl/dimm.c @@ -1080,11 +1080,9 @@ static int dimm_action(int argc, const char **argv, void *ctx, rc = action(single, &actx); } - if (actx.jdimms) { + if (actx.jdimms) util_display_json_array(actx.f_out, actx.jdimms, JSON_C_TO_STRING_PRETTY); - json_object_put(actx.jdimms); - } if (actx.f_out != stdout) fclose(actx.f_out); _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm