aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-08-09 09:45:28 -0700
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2019-08-10 20:59:53 +0200
commite9194a5c408810739c567d0102ac5228bdd6e668 (patch)
treea90880624c32db3f45b7a03569fcadb887747c92
parent7eadc8ef7eae1412bc5a4d9df969ba4a7f64db9f (diff)
downloadsubsurface-e9194a5c408810739c567d0102ac5228bdd6e668.tar.gz
Fix potential crash when saved_git_id is NULL
We have a safe strdup alternative. Let's just use it. Fixes #2220 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/file.c b/core/file.c
index 301a16e0b..abee7c793 100644
--- a/core/file.c
+++ b/core/file.c
@@ -264,7 +264,7 @@ int check_git_sha(const char *filename, struct git_repository **git_p, const cha
struct git_repository *git;
const char *branch = NULL;
- char *current_sha = strdup(saved_git_id);
+ char *current_sha = copy_string(saved_git_id);
git = is_git_repository(filename, &branch, NULL, false);
if (git_p)
*git_p = git;