summaryrefslogtreecommitdiffstats
path: root/libelf/elf_getarhdr.c
diff options
context:
space:
mode:
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 <[email protected]>, 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);