Re: [PATCH] covscan: add comment on false-positive on g_memdup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/27/19 6:16 PM, Victor Toso wrote:
From: Victor Toso <me@xxxxxxxxxxxxxx>

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@xxxxxxxxxx>

Acked-by: Uri Lublin <uril@xxxxxxxxxx>

Thanks,
  Uri.

---
  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);


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]