Skip to content

Commit 3c73d24

Browse files
Merge pull request nodegit#1995 from zawata/fix/dontFreeRepoOnRefError
Don't free the given repo on error in getReferences and getRemotes
2 parents 80b12ac + c12c5a4 commit 3c73d24

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

generate/templates/manual/repository/get_references.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ void GitRepository::GetReferencesWorker::Execute()
6161
}
6262

6363
git_strarray_free(&reference_names);
64-
git_repository_free(repo);
6564
delete baton->out;
6665
baton->out = NULL;
6766
return;

generate/templates/manual/repository/get_remotes.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ void GitRepository::GetRemotesWorker::Execute()
5151
if (giterr_last() != NULL) {
5252
baton->error = git_error_dup(giterr_last());
5353
}
54+
55+
git_repository_free(repo);
5456
delete baton->out;
5557
baton->out = NULL;
5658
return;
@@ -82,6 +84,9 @@ void GitRepository::GetRemotesWorker::Execute()
8284

8385
baton->out->push_back(remote);
8486
}
87+
88+
git_strarray_free(&remote_names);
89+
git_repository_free(repo);
8590
}
8691

8792
void GitRepository::GetRemotesWorker::HandleErrorCallback() {

lifecycleScripts/install.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ module.exports = function install() {
2929
}
3030

3131
return new Promise(function(resolve, reject) {
32+
const gypPath = path.join(__dirname, "..", "node_modules", "node-gyp", "bin", "node-gyp.js");
3233
var spawnedNodePreGyp = spawn(nodePreGyp, args, {
33-
env: Object.assign({}, process.env, {
34-
npm_config_node_gyp: path.join(__dirname, "..", "node_modules",
35-
"node-gyp", "bin", "node-gyp.js")
36-
})
34+
env: {
35+
...process.env,
36+
npm_config_node_gyp: gypPath
37+
},
38+
shell: process.platform === "win32"
3739
});
3840

3941
spawnedNodePreGyp.stdout.on("data", function(data) {

0 commit comments

Comments
 (0)