[SSSD] [PATCH] util-tests: Initialize boolean variable to default value

Lukas Slebodnik lslebodn at redhat.com
Tue Apr 7 14:33:25 UTC 2015


ehlo,

The boolean variable found_nss could be used uninitialized
in test test_known_service if service "nss" would not be found.
We would catch it with valgind.

Simple patch is attached.

LS
-------------- next part --------------
>From 25c34ac48146e5e8bf21a2765c281b13ce4b6786 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 6 Mar 2015 19:23:26 +0100
Subject: [PATCH] util-tests: Initialize boolean variable to default value

The boolean variable found_nss could be used uninitialized
in test test_known_service if service "nss" would not be found.
We would catch it with valgind.
---
 src/tests/util-tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tests/util-tests.c b/src/tests/util-tests.c
index 1cff0bb678ad60f857b28927a8f5a21df4f557d1..f9301a52352a75de402513b48225629cdf8d0467 100644
--- a/src/tests/util-tests.c
+++ b/src/tests/util-tests.c
@@ -1004,7 +1004,7 @@ END_TEST
 START_TEST(test_known_service)
 {
     const char * const * svcs;
-    bool found_nss;
+    bool found_nss = false;
     int i;
 
     /* Just make sure we can't find a bogus service and nss
-- 
2.3.4



More information about the sssd-devel mailing list