Merge branch 'nd/am-i18n-fix'
[gitweb.git] / builtin / for-each-ref.c
index b01d76a24323e86e9c9cbf1cd3adc9c0d1b2c6d8..0c5294e5e8fb92ca4757929a4bdf4bc49ca659bb 100644 (file)
@@ -962,7 +962,9 @@ static int opt_parse_sort(const struct option *opt, const char *arg, int unset)
        if (!arg) /* should --no-sort void the list ? */
                return -1;
 
-       *sort_tail = s = xcalloc(1, sizeof(*s));
+       s = xcalloc(1, sizeof(*s));
+       s->next = *sort_tail;
+       *sort_tail = s;
 
        if (*arg == '-') {
                s->reverse = 1;