From 50df94f549ae75669c071e610d08ffa9ed9e841c Mon Sep 17 00:00:00 2001 From: Nathan Kinder Date: Tue, 14 Sep 2010 14:53:43 -0700 Subject: Bug 630097 - (cov#15473) NULL dereference in ResHashCreate() If there is a problem allocating pResHash, we jump to the error label. The error label then dereferences pResHash to do a deep free, but it doesn't check if pResHash is NULL first. We need to check if pResHash is NULL before dereferencing it. --- lib/libsi18n/reshash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/libsi18n/reshash.c b/lib/libsi18n/reshash.c index 4134b2f9..6e3572fa 100644 --- a/lib/libsi18n/reshash.c +++ b/lib/libsi18n/reshash.c @@ -276,8 +276,8 @@ ResHash * ResHashCreate(char * name) goto done; error: - if (pResHash->treelist && pResHash->treelist->vlist) free(pResHash->treelist->vlist); - if (pResHash->treelist) free(pResHash->treelist); + if (pResHash && pResHash->treelist && pResHash->treelist->vlist) free(pResHash->treelist->vlist); + if (pResHash && pResHash->treelist) free(pResHash->treelist); if (pResHash) free(pResHash); return NULL; -- cgit