From: Robert Pengelly Date: Thu, 12 Jun 2025 20:12:53 +0000 (+0100) Subject: Fix symbol list X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=1cf503999ebcc82b7521296cabf0d29bacfbdc97;p=xar.git Fix symbol list --- diff --git a/ranlib.c b/ranlib.c index c513f05..728a962 100644 --- a/ranlib.c +++ b/ranlib.c @@ -408,7 +408,7 @@ static void hunk_get_symbols (void *object, unsigned long bytes, long offset) { while (1) { - name_size = array_to_be_integer (pos, 4); + name_size = array_to_integer (pos, 4); pos += 4; if (name_size == 0) { @@ -427,24 +427,26 @@ static void hunk_get_symbols (void *object, unsigned long bytes, long offset) { pos += 4; } else if (symbol_type == 129 || symbol_type == 130 || symbol_type == 136) { + strtab = xmalloc (sizeof (*strtab)); + strtab->length = strlen (symname); + + strtab->name = xstrdup (symname); + strtab->offset = offset; + + add_strtab (&gstrtab, strtab); + if (symbol_type == 130) { pos += 4; } - num_ref = array_to_be_integer (pos, 4); + num_ref = array_to_integer (pos, 4); num_ref *= 4; pos = pos + 4 + num_ref; } - strtab = xmalloc (sizeof (*strtab)); - strtab->length = strlen (symname); - - strtab->name = symname; - strtab->offset = offset; - - add_strtab (&gstrtab, strtab); + free (symname); }