push: unmark a local variable as static

There isn't any obvious reason for the 'struct string_list push_options' and 'struct string_list_item *item' to be marked as static, so unmark them as being static. Also, clear the push_options string_list to prevent memory leaking. Signed-off-by: Brandon Williams <bmwill@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Williams committed Mar 31, 2017 at 16:56 UTC 54cc8aca60e474e637e9d71b57ee2c6f1fb197e6
1 file changed +3 -2
builtin/push.c
+3 -2
@@ -510,8 +510,8 @@ int cmd_push(int argc, const char **argv, const char *prefix)
510 int push_cert = -1;
511 int rc;
512 const char *repo = NULL; /* default repository */
513 - static struct string_list push_options = STRING_LIST_INIT_DUP;
514 - static struct string_list_item *item;
513 + struct string_list push_options = STRING_LIST_INIT_DUP;
514 + const struct string_list_item *item;
515
516 struct option options[] = {
517 OPT__VERBOSITY(&verbosity),
@@ -584,6 +584,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
584 die(_("push options must not have new line characters"));
585
586 rc = do_push(repo, flags, &push_options);
587 + string_list_clear(&push_options, 0);
588 if (rc == -1)
589 usage_with_options(push_usage, options);
590 else