[lxc-devel] [PATCH] lxc-test-concurrent: initialize saveptr before use

Qiang Huang h.huangqiang at huawei.com
Tue Dec 10 11:37:46 UTC 2013


Or we'll get this build error:
...
cc1: warnings being treated as errors
concurrent.c: In function ‘main’:
concurrent.c:165: error: ‘saveptr’ may be used uninitialized in this
function
make[2]: *** [concurrent.o] Error 1

Signed-off-by: Qiang Huang <h.huangqiang at huawei.com>
---
 src/tests/concurrent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tests/concurrent.c b/src/tests/concurrent.c
index b9749df..7145d99 100644
--- a/src/tests/concurrent.c
+++ b/src/tests/concurrent.c
@@ -162,7 +162,7 @@ int main(int argc, char *argv[]) {
             quiet = 1;
             break;
         case 'm': {
-            char *mode_tok, *tok, *saveptr;
+            char *mode_tok, *tok, *saveptr = NULL;

             modes = NULL;
             for (i = 0, mode_tok = optarg;
-- 
1.8.3




More information about the lxc-devel mailing list