[PATCH - COVERITY] Small patch for talloc/testsuite: Fix CID 1291641 - Logically dead code
Jeremy Allison
jra at samba.org
Tue Apr 26 18:34:58 UTC 2016
On Tue, Apr 26, 2016 at 01:09:23PM +0200, Robin Hack wrote:
> Hello.
>
> I don't think that snprintf() can fail in this case but proper check is
> better than nothing.
>
> Sorry... not another badlock yet ;P.
Don't even *JOKE* about that :-). It really wasn't funny to
deal with :-).
LGTM. Second Team reviewer ?
> From 10673cdad10fb1e4238a2ad098e285b818d7e8fe Mon Sep 17 00:00:00 2001
> From: Robin Hack <hack.robin at gmail.com>
> Date: Tue, 26 Apr 2016 13:02:01 +0200
> Subject: [PATCH] talloc/testsuite: Fix CID 1291641 - Logically dead code
>
> Add check for snprintf return code.
>
> Signed-off-by: Robin Hack <hack.robin at gmail.com>
> ---
> lib/talloc/testsuite.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
> index 34410b8..5eab839 100644
> --- a/lib/talloc/testsuite.c
> +++ b/lib/talloc/testsuite.c
> @@ -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;
> }
> --
> 1.9.3
>
More information about the samba-technical
mailing list