Merge branch 'jk/remote-curl-an-array-in-struct-cannot-be-null' into maint
[gitweb.git] / transport.c
index b56620ed7f63aa12716e5168d817722716e6d89d..08bcd3a4eba42d2e72b9d84ec89e190c763300fa 100644 (file)
@@ -775,6 +775,7 @@ void transport_print_push_status(const char *dest, struct ref *refs,
                        *reject_reasons |= REJECT_NEEDS_FORCE;
                }
        }
+       free(head);
 }
 
 void transport_verify_remote_names(int nr_heads, const char **heads)
@@ -970,9 +971,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
        } else {
                /* Unknown protocol in URL. Pass to external handler. */
                int len = external_specification_len(url);
-               char *handler = xmalloc(len + 1);
-               handler[len] = 0;
-               strncpy(handler, url, len);
+               char *handler = xmemdupz(url, len);
                transport_helper_init(ret, handler);
        }