Name |
Last commit
|
Last update |
---|---|---|
.. | ||
binary.c | ||
blob.c | ||
diff_helpers.c | ||
diff_helpers.h | ||
diffiter.c | ||
drivers.c | ||
format_email.c | ||
index.c | ||
notify.c | ||
parse.c | ||
patch.c | ||
pathspec.c | ||
racediffiter.c | ||
rename.c | ||
stats.c | ||
submodules.c | ||
tree.c | ||
workdir.c |
When initializing a `git_diff_file_content` from a source whose data is derived from a blob, we simply assign the blob's pointer to the resulting struct without incrementing its refcount. Thus, the structure can only be used as long as the blob is kept alive by the caller. Fix the issue by using `git_blob_dup` instead of a direct assignment. This function will increment the refcount of the blob without allocating new memory, so it does exactly what we want. As `git_diff_file_content__unload` already frees the blob when `GIT_DIFF_FLAG__FREE_BLOB` is set, we don't need to add new code handling the free but only have to set that flag correctly.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
binary.c | Loading commit data... | |
blob.c | Loading commit data... | |
diff_helpers.c | Loading commit data... | |
diff_helpers.h | Loading commit data... | |
diffiter.c | Loading commit data... | |
drivers.c | Loading commit data... | |
format_email.c | Loading commit data... | |
index.c | Loading commit data... | |
notify.c | Loading commit data... | |
parse.c | Loading commit data... | |
patch.c | Loading commit data... | |
pathspec.c | Loading commit data... | |
racediffiter.c | Loading commit data... | |
rename.c | Loading commit data... | |
stats.c | Loading commit data... | |
submodules.c | Loading commit data... | |
tree.c | Loading commit data... | |
workdir.c | Loading commit data... |