From fc976d13b8ba5ee3cd44c5d32804c5a1c492494b Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 9 Sep 2009 12:17:10 +0300 Subject: Handle NULL header in doHeaderUnload() - avoids having to separately check elsewhere and avoids segfaulting on headerUnload() and headerReload() on NULL headers --- lib/header.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/header.c') diff --git a/lib/header.c b/lib/header.c index 45bbc2dd8..c4cc78e06 100644 --- a/lib/header.c +++ b/lib/header.c @@ -456,6 +456,8 @@ static void * doHeaderUnload(Header h, int i; int drlen, ndribbles; + if (h == NULL) return NULL; + /* Sort entries by (offset,tag). */ headerUnsort(h); @@ -1013,8 +1015,6 @@ int headerWrite(FD_t fd, Header h, enum hMagic magicp) size_t length; void * uh; - if (h == NULL) - return 1; uh = doHeaderUnload(h, &length); if (uh == NULL) return 1; -- cgit v1.2.3