Remove an unneeded local refactor in _dl_update_slotinfo

This commit is contained in:
Stan Shebs 2019-10-30 13:32:13 -07:00 committed by Fangrui Song
parent 7d7724e795
commit 396a77d48e

View File

@ -720,26 +720,25 @@ _dl_update_slotinfo (unsigned long int req_modid)
if (gen <= dtv[0].counter) if (gen <= dtv[0].counter)
continue; continue;
size_t modid = total + cnt;
/* If there is no map this means the entry is empty. */ /* If there is no map this means the entry is empty. */
struct link_map *map = listp->slotinfo[cnt].map; struct link_map *map = listp->slotinfo[cnt].map;
if (map == NULL) if (map == NULL)
{ {
if (dtv[-1].counter >= modid) if (dtv[-1].counter >= total + cnt)
{ {
/* If this modid was used at some point the memory /* If this modid was used at some point the memory
might still be allocated. */ might still be allocated. */
__signal_safe_free (dtv[modid].pointer.to_free); __signal_safe_free (dtv[total + cnt].pointer.to_free);
dtv[modid].pointer.val = TLS_DTV_UNALLOCATED; dtv[total + cnt].pointer.val = TLS_DTV_UNALLOCATED;
dtv[modid].pointer.to_free = NULL; dtv[total + cnt].pointer.to_free = NULL;
} }
continue; continue;
} }
assert (modid == map->l_tls_modid);
/* Check whether the current dtv array is large enough. */ /* Check whether the current dtv array is large enough. */
size_t modid = map->l_tls_modid;
assert (total + cnt == modid);
if (dtv[-1].counter < modid) if (dtv[-1].counter < modid)
{ {
/* Resize the dtv. */ /* Resize the dtv. */