summaryrefslogtreecommitdiff
path: root/lib/header.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-09-09 12:17:10 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-09-09 12:17:10 +0300
commitfc976d13b8ba5ee3cd44c5d32804c5a1c492494b (patch)
tree8b9b65c8d0bdc14c21c79ce4d29397bbdd732c81 /lib/header.c
parentcec00141387db0435a9d60912b7bd3482596eb7a (diff)
downloadlibrpm-tizen-fc976d13b8ba5ee3cd44c5d32804c5a1c492494b.tar.gz
librpm-tizen-fc976d13b8ba5ee3cd44c5d32804c5a1c492494b.tar.bz2
librpm-tizen-fc976d13b8ba5ee3cd44c5d32804c5a1c492494b.zip
Handle NULL header in doHeaderUnload()
- avoids having to separately check elsewhere and avoids segfaulting on headerUnload() and headerReload() on NULL headers
Diffstat (limited to 'lib/header.c')
-rw-r--r--lib/header.c4
1 files changed, 2 insertions, 2 deletions
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;