talloc/testsuite: Fix CID 1291641 - Logically dead code
authorRobin Hack <hack.robin@gmail.com>
Tue, 26 Apr 2016 11:02:01 +0000 (13:02 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 26 Apr 2016 20:48:21 +0000 (22:48 +0200)
Add check for snprintf return code.

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/talloc/testsuite.c

index 34410b81c3f3a12b262e9dd02a8174a0a89d5715..5eab839f51d3c395aef06d3e87d79e71ed203a41 100644 (file)
@@ -1795,11 +1795,11 @@ static bool test_pthread_talloc_passing(void)
         * They will use their own toplevel contexts.
         */
        for (i = 0; i < NUM_THREADS; i++) {
-               (void)snprintf(str_array[i],
-                               20,
-                               "thread:%d",
-                               i);
-               if (str_array[i] == NULL) {
+               ret = snprintf(str_array[i],
+                              20,
+                              "thread:%d",
+                              i);
+               if (ret < 0) {
                        printf("snprintf %d failed\n", i);
                        return false;
                }