diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-09-08 20:03:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-09-08 20:03:14 +0000 |
commit | 1181062126ed5daf104aa9f7beb847055c1d4adc (patch) | |
tree | 0454507ec9ae7d7ddea8b1518a142cd22ee188ec /elf/dl-object.c | |
parent | f6233fe00300ec9521967b63ed9b35184f27db29 (diff) | |
download | glibc-1181062126ed5daf104aa9f7beb847055c1d4adc.zip glibc-1181062126ed5daf104aa9f7beb847055c1d4adc.tar.gz glibc-1181062126ed5daf104aa9f7beb847055c1d4adc.tar.bz2 |
Update.
2001-09-08 Ulrich Drepper <drepper@redhat.com>
* elf/dl-object.c: Avoid allocating extra memory block for name.
* elf/dl-close.c (_dl_close): Don't free l_libname if it is no
allocated separately.
* elf/dl-load.c (_dl_map_object_from_fd): Likewise.
Diffstat (limited to 'elf/dl-object.c')
-rw-r--r-- | elf/dl-object.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/elf/dl-object.c b/elf/dl-object.c index 65e90d6..bfd4f2d 100644 --- a/elf/dl-object.c +++ b/elf/dl-object.c @@ -40,15 +40,17 @@ _dl_new_object (char *realname, const char *libname, int type, struct link_map *new; struct libname_list *newname; - new = (struct link_map *) calloc (sizeof *new, 1); - newname = (struct libname_list *) malloc (sizeof *newname + libname_len); - if (new == NULL || newname == NULL) + new = (struct link_map *) calloc (sizeof (*new) + sizeof (*newname) + + libname_len, 1); + if (new == NULL) return NULL; - new->l_name = realname; + newname = (struct libname_list *) (new + 1); newname->name = (char *) memcpy (newname + 1, libname, libname_len); newname->next = NULL; - newname->dont_free = 0; + newname->dont_free = 1; + + new->l_name = realname; new->l_libname = newname; new->l_type = type; new->l_loader = loader; |