public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 3/4] Remove weak declaration of free from <inline-hashtab.h>
Date: Sat, 08 Feb 2020 19:01:00 -0000	[thread overview]
Message-ID: <c1cfeffdf9edaf3ffd8259aa43de17b75737984c.1581182210.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1581182210.git.fweimer@redhat.com>

elf/dl-minimal.c provides a definition of free, so the function
pointer is always non-null, even before the final relocation
of the loader.
---
 include/inline-hashtab.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/include/inline-hashtab.h b/include/inline-hashtab.h
index d25bb95083..3c09978199 100644
--- a/include/inline-hashtab.h
+++ b/include/inline-hashtab.h
@@ -25,8 +25,6 @@
 #ifndef INLINE_HASHTAB_H
 # define INLINE_HASHTAB_H 1
 
-extern void weak_function free (void *ptr);
-
 struct hashtab
 {
   /* Table itself.  */
@@ -56,8 +54,7 @@ htab_create (void)
   ht->free = free;
   if (! ht->entries)
     {
-      if (ht->free)
-	ht->free (ht);
+      free (ht);
       return NULL;
     }
 
@@ -78,8 +75,7 @@ htab_delete (struct hashtab *htab)
   for (i = htab->size - 1; i >= 0; i--)
     free (htab->entries[i]);
 
-  if (htab->free)
-    htab->free (htab->entries);
+  htab->free (htab->entries);
   free (htab);
 }
 
@@ -167,8 +163,7 @@ htab_expand (struct hashtab *htab, int (*hash_fn) (void *))
      allocated early as long as there's no corresponding free(), but
      this isn't so much memory as to be significant.  */
 
-  if (htab->free)
-    htab->free (oentries);
+  htab->free (oentries);
 
   /* Use the free() corresponding to the malloc() above to free this
      up.  */
-- 
2.24.1


  parent reply	other threads:[~2020-02-08 19:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-08 19:01 [PATCH 0/4] Avoid malloc symbol interposition in the dynamic loader [BZ #25486] Florian Weimer
2020-02-08 19:01 ` [PATCH 2/4] elf: Extract _dl_sym_post, _dl_sym_find_caller_map from elf/dl-sym.c Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-08 19:01 ` [PATCH 1/4] elf: Introduce the rtld-stubbed-symbols makefile variable Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-08 19:01 ` Florian Weimer [this message]
2020-02-14 22:36   ` [PATCH 3/4] Remove weak declaration of free from <inline-hashtab.h> Carlos O'Donell
2020-02-08 19:02 ` [PATCH 4/4] ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] Florian Weimer
2020-02-14 22:36   ` Carlos O'Donell
2020-02-24 11:53   ` Florian Weimer
2020-02-14 22:36 ` [PATCH 0/4] Avoid malloc symbol interposition in the dynamic loader " Carlos O'Donell
2020-02-17 12:26 ` Lucas A. M. Magalhaes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c1cfeffdf9edaf3ffd8259aa43de17b75737984c.1581182210.git.fweimer@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).