diff options
author | Junio C Hamano <junkio@cox.net> | 2006-04-05 02:06:49 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-04-05 02:48:41 -0700 |
commit | 7d6c447145c07bb7d96a9aa17e33838fbe76e405 (patch) | |
tree | e89037cd85e74c88b08f0607135a34089101c6d8 /diff.c | |
parent | fa0cdab537b1ae635b5a64cddd29cddf2dfc4a1b (diff) | |
download | git-7d6c447145c07bb7d96a9aa17e33838fbe76e405.tar.gz git-7d6c447145c07bb7d96a9aa17e33838fbe76e405.tar.xz |
diff_flush(): leakfix.
We were leaking filepairs when output-format was set to
NO_OUTPUT.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 44 |
1 files changed, 25 insertions, 19 deletions
@@ -1225,28 +1225,34 @@ void diff_flush(struct diff_options *options) for (i = 0; i < q->nr; i++) { struct diff_filepair *p = q->queue[i]; - if ((diff_output_format == DIFF_FORMAT_NO_OUTPUT) || - (p->status == DIFF_STATUS_UNKNOWN)) - continue; - if (p->status == 0) - die("internal error in diff-resolve-rename-copy"); - switch (diff_output_format) { - case DIFF_FORMAT_PATCH: - diff_flush_patch(p, options); - break; - case DIFF_FORMAT_RAW: - case DIFF_FORMAT_NAME_STATUS: - diff_flush_raw(p, line_termination, - inter_name_termination, - options); + + switch (p->status) { + case DIFF_STATUS_UNKNOWN: break; - case DIFF_FORMAT_NAME: - diff_flush_name(p, - inter_name_termination, - line_termination); + case 0: + die("internal error in diff-resolve-rename-copy"); break; + default: + switch (diff_output_format) { + case DIFF_FORMAT_PATCH: + diff_flush_patch(p, options); + break; + case DIFF_FORMAT_RAW: + case DIFF_FORMAT_NAME_STATUS: + diff_flush_raw(p, line_termination, + inter_name_termination, + options); + break; + case DIFF_FORMAT_NAME: + diff_flush_name(p, + inter_name_termination, + line_termination); + break; + case DIFF_FORMAT_NO_OUTPUT: + break; + } } - diff_free_filepair(q->queue[i]); + diff_free_filepair(p); } free(q->queue); q->queue = NULL; |