NULL pointer was passed to unlink() if memory allocation
for mc_ctx->file failed.

Patch attached.

Michal
>From 3179368a8b34bf7d117f6f67c4b5f63d42b20ceb Mon Sep 17 00:00:00 2001
From: Michal Zidek <[email protected]>
Date: Wed, 26 Sep 2012 16:17:39 +0200
Subject: [PATCH] Possible use of NULL pointer in function
 sss_mmap_cache_init.

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

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to