[PATCH 3/3] range-diff: clear `other_arg` at end of function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We were leaking memory by not clearing `other_arg` after we were done
using it. Clear it after we've finished using it.

Note that this isn't strictly necessary since the memory will be
reclaimed once the command exits. However, since we are releasing the
strbufs, we should also clear `other_arg` for consistency.

Signed-off-by: Denton Liu <liu.denton@xxxxxxxxx>
---
 builtin/range-diff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/builtin/range-diff.c b/builtin/range-diff.c
index 98acf3533e..d8a4670629 100644
--- a/builtin/range-diff.c
+++ b/builtin/range-diff.c
@@ -84,6 +84,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
 	res = show_range_diff(range1.buf, range2.buf, creation_factor,
 			      simple_color < 1, &diffopt, &other_arg);
 
+	argv_array_clear(&other_arg);
 	strbuf_release(&range1);
 	strbuf_release(&range2);
 
-- 
2.24.0.612.g9b7bad38f5




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux