summaryrefslogtreecommitdiff
path: root/libelf/elf_getarhdr.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2008-12-03 03:41:58 +0000
committerRoland McGrath <roland@redhat.com>2008-12-03 03:41:58 +0000
commita845f68bf43f90e0670ed6b33154f2aff98ad46b (patch)
tree3bc6809479ef0de95b106f0f8616ca8cb0c02cc2 /libelf/elf_getarhdr.c
parenta4c9d281616090c46ffc4fc3234d64e915008e1a (diff)
downloadelfutils-a845f68bf43f90e0670ed6b33154f2aff98ad46b.tar.gz
src/
2008-12-02 Roland McGrath <roland@redhat.com> * readelf.c (count_dwflmod, process_file): Don't presume encoding of nonzero OFFSET argument to dwfl_getmodules.
Diffstat (limited to 'libelf/elf_getarhdr.c')
-rw-r--r--libelf/elf_getarhdr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libelf/elf_getarhdr.c b/libelf/elf_getarhdr.c
index deeb56db..875b2a10 100644
--- a/libelf/elf_getarhdr.c
+++ b/libelf/elf_getarhdr.c
@@ -1,5 +1,5 @@
/* Read header of next archive member.
- Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2008 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
@@ -63,6 +63,9 @@ Elf_Arhdr *
elf_getarhdr (elf)
Elf *elf;
{
+ if (elf == NULL)
+ return NULL;
+
Elf *parent = elf->parent;
/* Calling this function is not ok for any file type but archives. */
@@ -78,7 +81,6 @@ elf_getarhdr (elf)
/* Something went wrong. Maybe there is no member left. */
return NULL;
-
/* We can be sure the parent is an archive. */
assert (parent->kind == ELF_K_AR);