summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2016-04-04 16:30:02 -0400
committerKeith Bostic <keith@wiredtiger.com>2016-04-04 16:30:02 -0400
commit77caa9415b05f064d3c5e3c953e5ab7a2d7b7eec (patch)
treecbb9272905bc01ee4af4b0b974c0b43f35518009
parent1d340e2ce9d3f06adb64fe82cf610cc09e610c5f (diff)
downloadmongo-77caa9415b05f064d3c5e3c953e5ab7a2d7b7eec.tar.gz
SERVER-23504: Coverity analysis defect 98177: Resource leak
Don't leak the variable value if the call to __wt_fprintf fails.
-rw-r--r--src/cursor/cur_backup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c
index 2ba73eb86c9..5be9b311a79 100644
--- a/src/cursor/cur_backup.c
+++ b/src/cursor/cur_backup.c
@@ -440,6 +440,7 @@ __backup_list_uri_append(
WT_SESSION_IMPL *session, const char *name, bool *skip)
{
WT_CURSOR_BACKUP *cb;
+ WT_DECL_RET;
char *value;
cb = session->bkp_cursor;
@@ -472,8 +473,9 @@ __backup_list_uri_append(
/* Add the metadata entry to the backup file. */
WT_RET(__wt_metadata_search(session, name, &value));
- WT_RET(__wt_fprintf(session, cb->bfh, "%s\n%s\n", name, value));
+ ret = __wt_fprintf(session, cb->bfh, "%s\n%s\n", name, value);
__wt_free(session, value);
+ WT_RET(ret);
/* Add file type objects to the list of files to be copied. */
if (WT_PREFIX_MATCH(name, "file:"))