Skip to content

Commit

Permalink
Simplify OOM handling in ldconfig.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed May 3, 2010
1 parent 49bd556 commit f297602
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
2010-05-03 Ulrich Drepper <drepper@redhat.com>

* elf/chroot_canon.c (chroot_canon): Use xmalloc and xrealloc.

* elf/ldconfig.c (parse_conf_include): Don't fall back to
directories named in config file outside the chroot.

Expand Down
10 changes: 3 additions & 7 deletions elf/chroot_canon.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Return the canonical absolute name of a given file inside chroot.
Copyright (C) 1996,1997,1998,1999,2000,2001,2004,2005
Copyright (C) 1996,1997,1998,1999,2000,2001,2004,2005,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -58,9 +58,7 @@ chroot_canon (const char *chroot, const char *name)
return NULL;
}

rpath = malloc (chroot_len + PATH_MAX);
if (rpath == NULL)
return NULL;
rpath = xmalloc (chroot_len + PATH_MAX);

rpath_limit = rpath + chroot_len + PATH_MAX;

Expand Down Expand Up @@ -109,9 +107,7 @@ chroot_canon (const char *chroot, const char *name)
new_size += end - start + 1;
else
new_size += PATH_MAX;
new_rpath = (char *) realloc (rpath, new_size);
if (new_rpath == NULL)
goto error;
new_rpath = (char *) xrealloc (rpath, new_size);
rpath = new_rpath;
rpath_limit = rpath + new_size;

Expand Down

0 comments on commit f297602

Please sign in to comment.