Skip to content

Commit

Permalink
Merge pull request #1995 from zawata/fix/dontFreeRepoOnRefError
Browse files Browse the repository at this point in the history
Don't free the given repo on error in getReferences and getRemotes
  • Loading branch information
ianhattendorf committed Apr 12, 2024
2 parents 80b12ac + c12c5a4 commit 3c73d24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion generate/templates/manual/repository/get_references.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ void GitRepository::GetReferencesWorker::Execute()
}

git_strarray_free(&reference_names);
git_repository_free(repo);
delete baton->out;
baton->out = NULL;
return;
Expand Down
5 changes: 5 additions & 0 deletions generate/templates/manual/repository/get_remotes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ void GitRepository::GetRemotesWorker::Execute()
if (giterr_last() != NULL) {
baton->error = git_error_dup(giterr_last());
}

git_repository_free(repo);
delete baton->out;
baton->out = NULL;
return;
Expand Down Expand Up @@ -82,6 +84,9 @@ void GitRepository::GetRemotesWorker::Execute()

baton->out->push_back(remote);
}

git_strarray_free(&remote_names);
git_repository_free(repo);
}

void GitRepository::GetRemotesWorker::HandleErrorCallback() {
Expand Down
10 changes: 6 additions & 4 deletions lifecycleScripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ module.exports = function install() {
}

return new Promise(function(resolve, reject) {
const gypPath = path.join(__dirname, "..", "node_modules", "node-gyp", "bin", "node-gyp.js");
var spawnedNodePreGyp = spawn(nodePreGyp, args, {
env: Object.assign({}, process.env, {
npm_config_node_gyp: path.join(__dirname, "..", "node_modules",
"node-gyp", "bin", "node-gyp.js")
})
env: {
...process.env,
npm_config_node_gyp: gypPath
},
shell: process.platform === "win32"
});

spawnedNodePreGyp.stdout.on("data", function(data) {
Expand Down

0 comments on commit 3c73d24

Please sign in to comment.