summaryrefslogtreecommitdiff
path: root/elf/dl-object.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-01 17:58:59 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-01 17:58:59 +0000
commit76156ea152d970103a4c69541d816cacaf0ebc74 (patch)
tree610f021a0fec311572012deb6fc23eec0f4ca9ac /elf/dl-object.c
parenta8a1269d8814fe54d5d25619ca138849bca29b78 (diff)
Update.
1998-09-01 17:53 Ulrich Drepper <drepper@cygnus.com> * elf/dl-load.c (add_name_to_object): Change return type to void and make NAME parameter const. Allocate room for NAME in same memory block used for l_libname entry. (_dl_map_object_from_fd): Don't free NAME on failure. (map_segment): Pass SONAME to add_name_to_object, not a copy. (_dl_map_object): Don't create copy of NAME. Pass NAME to _dl_map_object_from_fd. * elf/dl-object.c (dl_new_object): Allocate room for NAME in same memory block used for l_libname entry. * elf/dl-close.c: Adjust free()ing for this change.
Diffstat (limited to 'elf/dl-object.c')
-rw-r--r--elf/dl-object.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/elf/dl-object.c b/elf/dl-object.c
index e91beac926..97edd8189c 100644
--- a/elf/dl-object.c
+++ b/elf/dl-object.c
@@ -35,14 +35,14 @@ struct link_map *
internal_function
_dl_new_object (char *realname, const char *libname, int type, int find_origin)
{
- struct link_map *new = malloc (sizeof *new);
- struct libname_list *newname = malloc (sizeof *newname);
+ size_t libname_len = strlen (libname) + 1;
+ struct link_map *new = calloc (sizeof *new, 1);
+ struct libname_list *newname = malloc (sizeof *newname + libname_len);
if (! new || ! newname)
return NULL;
- memset (new, 0, sizeof *new);
new->l_name = realname;
- newname->name = libname;
+ newname->name = memcpy (newname + 1, libname, libname_len);
newname->next = NULL;
new->l_libname = newname;
new->l_type = type;