while (1) {
- name_size = array_to_be_integer (pos, 4);
+ name_size = array_to_integer (pos, 4);
pos += 4;
if (name_size == 0) {
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);
}