diff --git a/src/common/libkvs/kvs_dir.c b/src/common/libkvs/kvs_dir.c index a6eea14be063..e0ad750e5ef2 100644 --- a/src/common/libkvs/kvs_dir.c +++ b/src/common/libkvs/kvs_dir.c @@ -71,6 +71,10 @@ kvsdir_t *kvsdir_create (flux_t *handle, const char *rootref, { kvsdir_t *dir; + if (!key || !json_str) { + errno = EINVAL; + return NULL; + } if (!(dir = calloc (1, sizeof (*dir)))) goto nomem;