Cleanup: avoid memory leak

Coverity CID 208333

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-12-26 14:17:54 -08:00
parent da1d6e97f6
commit 42db44510d

View file

@ -1099,7 +1099,9 @@ static void create_commit_message(struct membuffer *msg, bool create_empty)
} while ((dc = dc->next) != NULL);
put_format(msg, "\n");
}
put_format(msg, "Created by %s\n", subsurface_user_agent());
const char *user_agent = subsurface_user_agent();
put_format(msg, "Created by %s\n", user_agent);
free((void *)user_agent);
}
static int create_new_commit(git_repository *repo, const char *remote, const char *branch, git_oid *tree_id, bool create_empty)