Skip to content

Commit

Permalink
* elf/dl-lookup.c (add_dependency): Handle failing memory
Browse files Browse the repository at this point in the history
	allocation for dependency list.  Remove unnecessary check.
  • Loading branch information
Ulrich Drepper committed Sep 19, 2007
1 parent e1db049 commit 715899d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2007-09-19 Ulrich Drepper <drepper@redhat.com>

* elf/dl-lookup.c (add_dependency): Handle failing memory
allocation for dependency list. Remove unnecessary check.

* sysdeps/posix/getaddrinfo.c (getaddrinfo): Avoid unnecessary
open/close when determining source addresses.

Expand Down
12 changes: 6 additions & 6 deletions elf/dl-lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
goto out_check;

/* Avoid references to objects which cannot be unloaded anyway. */
if (map->l_type != lt_loaded
|| (map->l_flags_1 & DF_1_NODELETE) != 0)
assert (map->l_type == lt_loaded);
if ((map->l_flags_1 & DF_1_NODELETE) != 0)
goto out;

/* If the object with the undefined reference cannot be removed ever
Expand Down Expand Up @@ -197,13 +197,13 @@ add_dependency (struct link_map *undef_map, struct link_map *map, int flags)
}

/* If we didn't manage to allocate memory for the list this is
no fatal mistake. We simply increment the use counter of the
referenced object and don't record the dependencies. This
means this increment can never be reverted and the object
will never be unloaded. This is semantically the correct
no fatal mistake. We simply make sure the referenced object
cannot be unloaded. This is semantically the correct
behavior. */
if (__builtin_expect (act < undef_map->l_reldepsmax, 1))
undef_map->l_reldeps[undef_map->l_reldepsact++] = map;
else
map->l_flags_1 |= DF_1_NODELETE;

/* Display information if we are debugging. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
Expand Down

0 comments on commit 715899d

Please sign in to comment.