Skip to content

Commit ee4a1d6

Browse files
ttaylorrgitster
authored andcommitted
builtin/multi-pack-index.c: don't leak concatenated options
The `multi-pack-index` builtin dynamically allocates an array of command-line option for each of its separate modes by calling add_common_options() to concatante the common options with sub-command specific ones. Because this operation allocates a new array, we have to be careful to remember to free it. We already do this in the repack and write sub-commands, but verify and expire don't. Rectify this by calling FREE_AND_NULL as the other modes do. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e6432e0 commit ee4a1d6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

builtin/multi-pack-index.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ static int cmd_multi_pack_index_verify(int argc, const char **argv)
167167
usage_with_options(builtin_multi_pack_index_verify_usage,
168168
options);
169169

170+
FREE_AND_NULL(options);
171+
170172
return verify_midx_file(the_repository, opts.object_dir, opts.flags);
171173
}
172174

@@ -191,6 +193,8 @@ static int cmd_multi_pack_index_expire(int argc, const char **argv)
191193
usage_with_options(builtin_multi_pack_index_expire_usage,
192194
options);
193195

196+
FREE_AND_NULL(options);
197+
194198
return expire_midx_packs(the_repository, opts.object_dir, opts.flags);
195199
}
196200

0 commit comments

Comments
 (0)