8000 Merge pull request #6748 from csware/fix-memleaks · libgit2/libgit2@4ab9c40 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ab9c40

Browse files
authored
Merge pull request #6748 from csware/fix-memleaks
Fix memory leaks
2 parents 99018a0 + f9e0554 commit 4ab9c40

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/libgit2/repository.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,14 +3246,18 @@ int git_repository_set_workdir(
32463246
if (git_fs_path_prettify_dir(&path, workdir, NULL) < 0)
32473247
return -1;
32483248

3249-
if (repo->workdir && strcmp(repo->workdir, path.ptr) == 0)
3249+
if (repo->workdir && strcmp(repo->workdir, path.ptr) == 0) {
3250+
git_str_dispose(&path);
32503251
return 0;
3252+
}
32513253

32523254
if (update_gitlink) {
32533255
git_config *config;
32543256

3255-
if (git_repository_config__weakptr(&config, repo) < 0)
3257+
if (git_repository_config__weakptr(&config, repo) < 0) {
3258+
git_str_dispose(&path);
32563259
return -1;
3260+
}
32573261

32583262
error = repo_write_gitlink(path.ptr, git_repository_path(repo), false);
32593263

@@ -3275,6 +3279,7 @@ int git_repository_set_workdir(
32753279

32763280
git__free(old_workdir);
32773281
}
3282+
git_str_dispose(&path);
32783283

32793284
return error;
32803285
}

0 commit comments

Comments
 (0)
0