[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 36/39] contrib: remove unnecessary strdup()
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH 36/39] contrib: remove unnecessary strdup() |
Date: |
Fri, 26 Jun 2015 16:49:42 +0200 |
getopt() optarg points to argv memory, no need to dup those values,
fixes small leaks detected by clang-analyzer.
Signed-off-by: Marc-André Lureau <address@hidden>
---
contrib/ivshmem-client/main.c | 2 +-
contrib/ivshmem-server/main.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/contrib/ivshmem-client/main.c b/contrib/ivshmem-client/main.c
index 5d85ae7..bd7cbfc 100644
--- a/contrib/ivshmem-client/main.c
+++ b/contrib/ivshmem-client/main.c
@@ -53,7 +53,7 @@ ivshmem_client_parse_args(IvshmemClientArgs *args, int argc,
char *argv[])
break;
case 'S': /* unix_sock_path */
- args->unix_sock_path = strdup(optarg);
+ args->unix_sock_path = optarg;
break;
default:
diff --git a/contrib/ivshmem-server/main.c b/contrib/ivshmem-server/main.c
index 67b3d61..66fc9b3 100644
--- a/contrib/ivshmem-server/main.c
+++ b/contrib/ivshmem-server/main.c
@@ -93,15 +93,15 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int
argc, char *argv[])
break;
case 'p': /* pid_file */
- args->pid_file = strdup(optarg);
+ args->pid_file = optarg;
break;
case 'S': /* unix_socket_path */
- args->unix_socket_path = strdup(optarg);
+ args->unix_socket_path = optarg;
break;
case 'm': /* shm_path */
- args->shm_path = strdup(optarg);
+ args->shm_path = optarg;
break;
case 'l': /* shm_size */
--
2.4.3
- [Qemu-devel] [PATCH 25/39] ivshmem: add device description, (continued)
- [Qemu-devel] [PATCH 25/39] ivshmem: add device description, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 26/39] ivshmem: fix pci_ivshmem_exit(), Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 28/39] ivshmem: error on too many eventfd received, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 27/39] ivshmem: replace 'guest' for 'peer' appropriately, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 29/39] ivshmem: reset mask on device reset, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 31/39] ivshmem-client: check the number of vectors, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 32/39] ivshmem-server: use a uint16 for client ID, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 33/39] ivshmem-server: include necessary headers, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 30/39] contrib: add ivshmem client and server, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 34/39] docs: update ivshmem device spec, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 36/39] contrib: remove unnecessary strdup(),
Marc-André Lureau <=
- [Qemu-devel] [PATCH 35/39] ivshmem: add check on protocol version in QEMU, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 37/39] msix: implement read-only pba write, Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 38/39] qtest: add qtest_add_abrt_handler(), Marc-André Lureau, 2015/06/26
- [Qemu-devel] [PATCH 39/39] tests: Add ivshmem qtest, Marc-André Lureau, 2015/06/26