FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

git_treebuilder_write_with_buffer refactorings by pks-t · Pull Request #4182 · libgit2/libgit2 · GitHub

Repository navigation

git_treebuilder_write_with_buffer refactorings - #4182

Merged
ethomson merged 3 commits into
libgit2:masterfrom
pks-t:pks/treebuilder
Mar 28, 2017
Merged

ethomson merged 3 commits into
libgit2:masterfrom
pks-t:pks/treebuilder

Conversation

pks-t commented Mar 28, 2017

Copy link
Copy Markdown
Member

Some small refactorings and memory leak fixes for the git_treebuilder_write_with_buffer function. This was triggered by #4181, but does not actually fix the issue.

pks-t added 3 commits March 28, 2017 08:39
While we detect errors in `git_treebuilder_write_with_buffer`, we just
exit directly instead of freeing allocated memory. Fix this by
remembering error codes and skipping forward to the function's cleanup
code.
The `git_tree_entry *entry` variable is defined twice inside of this
function. While this is not a problem currently, remove the shadowing
variable to avoid future confusion.
While writing the tree inside of a buffer, we check whether the buffer
runs out of memory after each tree entry. While we set the error code as
soon as we detect the OOM situation, we happily proceed iterating over
the entries. This is not useful at all, as we will try to write into the
buffer repeatedly, which cannot work.

Fix this by exiting as soon as we are OOM.
ethomson merged commit caf7a7a into libgit2:master Mar 28, 2017
pks-t deleted the pks/treebuilder branch April 7, 2017 09:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL