[SSSD] [PATCH] Free resources if fileno failed

Jakub Hrozek jhrozek at redhat.com
Tue Dec 18 18:39:45 UTC 2012


Detected by Coverity. I think I was too spoiled with talloc recently.
-------------- next part --------------
>From 4a1d817e00ceb55011a992f376dfd668f68204cb Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Tue, 18 Dec 2012 19:33:57 +0100
Subject: [PATCH] Free resources if fileno failed

---
 src/util/debug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/debug.c b/src/util/debug.c
index f107f168be6e6dbb9e0bb6718ccec73e7b84ef23..54fb8011be7a4c787b201314f1f08d1b46d3b66c 100644
--- a/src/util/debug.c
+++ b/src/util/debug.c
@@ -209,6 +209,8 @@ int open_debug_file_ex(const char *filename, FILE **filep)
 
     debug_fd = fileno(f);
     if (debug_fd == -1) {
+        fclose(f);
+        free(logpath);
         return EIO;
     }
 
-- 
1.8.0.2



More information about the sssd-devel mailing list