[Spice-devel] [PATCH] covscan: add comment on false-positive on g_memdup()
Victor Toso
victortoso at redhat.com
Tue Aug 27 15:16:59 UTC 2019
From: Victor Toso <me at victortoso.com>
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 at 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.21.0
More information about the Spice-devel
mailing list