diff options
Diffstat (limited to 'shared.c')
| -rw-r--r-- | shared.c | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -352,7 +352,7 @@ void cgit_diff_tree(const struct object_id *old_oid, | |||
| 352 | opt.format_callback = cgit_diff_tree_cb; | 352 | opt.format_callback = cgit_diff_tree_cb; |
| 353 | opt.format_callback_data = fn; | 353 | opt.format_callback_data = fn; |
| 354 | if (prefix) { | 354 | if (prefix) { |
| 355 | item.match = prefix; | 355 | item.match = xstrdup(prefix); |
| 356 | item.len = strlen(prefix); | 356 | item.len = strlen(prefix); |
| 357 | opt.pathspec.nr = 1; | 357 | opt.pathspec.nr = 1; |
| 358 | opt.pathspec.items = &item; | 358 | opt.pathspec.items = &item; |
| @@ -365,6 +365,8 @@ void cgit_diff_tree(const struct object_id *old_oid, | |||
| 365 | diff_root_tree_sha1(new_oid->hash, "", &opt); | 365 | diff_root_tree_sha1(new_oid->hash, "", &opt); |
| 366 | diffcore_std(&opt); | 366 | diffcore_std(&opt); |
| 367 | diff_flush(&opt); | 367 | diff_flush(&opt); |
| 368 | |||
| 369 | free(item.match); | ||
| 368 | } | 370 | } |
| 369 | 371 | ||
| 370 | void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix) | 372 | void cgit_diff_commit(struct commit *commit, filepair_fn fn, const char *prefix) |
