reflog-walk: include all fields when freeing complete_reflogs
[gitweb.git] / builtin / submodule--helper.c
index 36e4231821c0acbb6fe21948c752d4ee7c96405d..566a5b6a6f8937742e83577918a94f0dcb20c66c 100644 (file)
@@ -376,12 +376,12 @@ static void init_submodule(const char *path, const char *prefix, int quiet)
        strbuf_reset(&sb);
        strbuf_addf(&sb, "submodule.%s.url", sub->name);
        if (git_config_get_string(sb.buf, &url)) {
-               url = xstrdup(sub->url);
-
-               if (!url)
+               if (!sub->url)
                        die(_("No url found for submodule path '%s' in .gitmodules"),
                                displaypath);
 
+               url = xstrdup(sub->url);
+
                /* Possibly a url relative to parent */
                if (starts_with_dot_dot_slash(url) ||
                    starts_with_dot_slash(url)) {