spice-vdagent/0012-covscan-add-comment-on-false-positive-on-g_memdup.patch
2019-10-04 08:54:42 -07:00

39 lines
1.3 KiB
Diff

From 56a65ad1c6615dac97bb45865735a5a388266ffa Mon Sep 17 00:00:00 2001
From: Victor Toso <me@victortoso.com>
Date: Tue, 27 Aug 2019 17:15:56 +0200
Subject: [PATCH 12/23] covscan: add comment on false-positive on g_memdup()
Previous commit set last element of orig_argv array to NULL.
That's redundant as g_memdup() uses memcpy() and it would do
just that. Add a comment that the reason for this change is
to workaround clang's warning.
Suggested by Uri.
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
---
src/vdagent/vdagent.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/vdagent/vdagent.c b/src/vdagent/vdagent.c
index 5b146db..a944214 100644
--- a/src/vdagent/vdagent.c
+++ b/src/vdagent/vdagent.c
@@ -418,10 +418,8 @@ int main(int argc, char *argv[])
GOptionContext *context;
GError *error = NULL;
VDAgent *agent;
- char **orig_argv;
-
- orig_argv = g_memdup(argv, sizeof(char*) * (argc+1));
- orig_argv[argc] = NULL;
+ char **orig_argv = g_memdup(argv, sizeof(char*) * (argc+1));
+ orig_argv[argc] = NULL; /* To avoid clang analyzer false-positive */
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, entries, NULL);
--
2.23.0