[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sssd-devel
Subject:    [PATCH] Possible use of NULL pointer in function sss_mmap_cache_init.
From:       mzidek () redhat ! com (Michal Zidek)
Date:       2012-09-26 14:17:39
Message-ID: mailman.310.1348678332.1584.sssd-devel () lists ! fedorahosted ! org
[Download RAW message or body]

NULL pointer was passed to unlink() if memory allocation
for mc_ctx->file failed.
---
 src/responder/nss/nsssrv_mmap_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/responder/nss/nsssrv_mmap_cache.c b/src/responder/nss/nsssrv_mmap_cache.c
index f402564..5013269 100644
--- a/src/responder/nss/nsssrv_mmap_cache.c
+++ b/src/responder/nss/nsssrv_mmap_cache.c
@@ -709,7 +709,7 @@ done:
         if (mc_ctx && mc_ctx->mmap_base) {
             munmap(mc_ctx->mmap_base, mc_ctx->mmap_size);
         }
-        if (mc_ctx && mc_ctx->fd != -1) {
+        if (mc_ctx && mc_ctx->fd != -1 && mc_ctx->file) {
             close(mc_ctx->fd);
             ret = unlink(mc_ctx->file);
             if (ret == -1) {
-- 
1.7.11.2


--------------040005070601090303080004--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic