]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Remove an unneeded local refactor in _dl_update_slotinfo
authorStan Shebs <stanshebs@google.com>
Wed, 30 Oct 2019 20:32:13 +0000 (13:32 -0700)
committerFangrui Song <i@maskray.me>
Sat, 28 Aug 2021 00:26:03 +0000 (17:26 -0700)
elf/dl-tls.c

index 47242097fcb06304fc7a8a6e5d129dcbb238d904..67198f706bf39eac058805e3ea6e0c6152dcf7a0 100644 (file)
@@ -720,26 +720,25 @@ _dl_update_slotinfo (unsigned long int req_modid)
              if (gen <= dtv[0].counter)
                continue;
 
-             size_t modid = total + cnt;
-
              /* If there is no map this means the entry is empty.  */
              struct link_map *map = listp->slotinfo[cnt].map;
              if (map == NULL)
                {
-                 if (dtv[-1].counter >= modid)
+                 if (dtv[-1].counter >= total + cnt)
                    {
                      /* If this modid was used at some point the memory
                         might still be allocated.  */
-                     __signal_safe_free (dtv[modid].pointer.to_free);
-                     dtv[modid].pointer.val = TLS_DTV_UNALLOCATED;
-                     dtv[modid].pointer.to_free = NULL;
+                     __signal_safe_free (dtv[total + cnt].pointer.to_free);
+                     dtv[total + cnt].pointer.val = TLS_DTV_UNALLOCATED;
+                     dtv[total + cnt].pointer.to_free = NULL;
                    }
 
                  continue;
                }
 
-             assert (modid == map->l_tls_modid);
              /* 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)
                {
                  /* Resize the dtv.  */