mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Don't return before freeing references
This commit is contained in:
@@ -156,6 +156,7 @@ namespace v8_extensions {
|
||||
}
|
||||
|
||||
CefRefPtr<CefV8Value> GetAheadBehindCounts() {
|
||||
CefRefPtr<CefV8Value> result = NULL;
|
||||
git_reference *head;
|
||||
if (git_repository_head(&head, repo) == GIT_OK) {
|
||||
const char* upstreamBranchName;
|
||||
@@ -167,12 +168,11 @@ namespace v8_extensions {
|
||||
const git_oid* upstreamSha = git_reference_target(upstream);
|
||||
git_oid mergeBase;
|
||||
if (git_merge_base(&mergeBase, repo, headSha, upstreamSha) == GIT_OK) {
|
||||
CefRefPtr<CefV8Value> result = CefV8Value::CreateObject(NULL);
|
||||
result = CefV8Value::CreateObject(NULL);
|
||||
int ahead = GetCommitCount(headSha, &mergeBase);
|
||||
result->SetValue("ahead", CefV8Value::CreateInt(ahead), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
int behind = GetCommitCount(upstreamSha, &mergeBase);
|
||||
result->SetValue("behind", CefV8Value::CreateInt(behind), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
return result;
|
||||
}
|
||||
git_reference_free(upstream);
|
||||
}
|
||||
@@ -181,7 +181,10 @@ namespace v8_extensions {
|
||||
git_reference_free(head);
|
||||
}
|
||||
|
||||
return CefV8Value::CreateNull();
|
||||
if (result != NULL)
|
||||
return result;
|
||||
else
|
||||
return CefV8Value::CreateNull();
|
||||
}
|
||||
|
||||
CefRefPtr<CefV8Value> IsIgnored(const char *path) {
|
||||
|
||||
Reference in New Issue
Block a user