From b9d616a98d2f3655dfb7e422ec9a8c789c229ba7 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 12 Apr 2018 12:29:03 -0700 Subject: [PATCH] modules/kvs: fix memory leak in namespace_create() Problem: valgrind test fails when private KVS namespace is made part of job setup. Looks like some memory allocated in namespace_create() that was freed in the error path, was not freed in the non-error path. Fix that. Fixes #1483 --- src/modules/kvs/kvs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/kvs/kvs.c b/src/modules/kvs/kvs.c index 2c113177bb2e..684b3b0fac3a 100644 --- a/src/modules/kvs/kvs.c +++ b/src/modules/kvs/kvs.c @@ -2594,6 +2594,8 @@ static int namespace_create (kvs_ctx_t *ctx, const char *namespace, goto cleanup_remove_root; } + json_decref (rootdir); + free (data); return 0; cleanup_remove_root: