summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2014-12-22 17:36:24 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2014-12-22 17:36:24 +1100
commit45d8cb14404bd5ec9511c47d97338a6bce62dcdf (patch)
treee430432e9698dd51f1280a5f1f927579f3d666e8
parentf550dc3b8a055a1bc8bf4d4094eaf8e3bd5449de (diff)
downloadmongo-45d8cb14404bd5ec9511c47d97338a6bce62dcdf.tar.gz
Fix bugs reported by Coverity:
1260223 1260224 One potential memory leak, and one redundant NULL check.
-rw-r--r--src/conn/conn_api.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index 12c9bec31ef..f87467543d1 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -1015,7 +1015,7 @@ __conn_config_env(WT_SESSION_IMPL *session, const char *cfg[], WT_ITEM *cbuf)
return (0);
len = strlen(env_config);
if (len == 0)
- return (0);
+ goto err; /* Free the memory */
WT_ERR(__wt_buf_set(session, cbuf, env_config, len + 1));
/*
@@ -1043,8 +1043,7 @@ __conn_config_env(WT_SESSION_IMPL *session, const char *cfg[], WT_ITEM *cbuf)
/* Append it to the stack. */
__conn_config_append(cfg, cbuf->data);
-err: if (env_config != NULL)
- __wt_free(session, env_config);
+err: __wt_free(session, env_config);
return (ret);
}