[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 37/47] contrib: remove unnecessary strdup()
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v4 37/47] contrib: remove unnecessary strdup() |
Date: |
Thu, 24 Sep 2015 13:37:39 +0200 |
From: Marc-André Lureau <address@hidden>
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>
Reviewed-by: Vladimir Sementsov-Ogievskiy <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 cd8d9ed..71e87ea 100644
--- a/contrib/ivshmem-server/main.c
+++ b/contrib/ivshmem-server/main.c
@@ -92,15 +92,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 v4 26/47] ivshmem: add device description, (continued)
- [Qemu-devel] [PATCH v4 26/47] ivshmem: add device description, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 27/47] ivshmem: fix pci_ivshmem_exit(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 28/47] ivshmem: replace 'guest' for 'peer' appropriately, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 29/47] ivshmem: error on too many eventfd received, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 30/47] ivshmem: reset mask on device reset, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 32/47] ivshmem-client: check the number of vectors, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 33/47] ivshmem-server: use a uint16 for client ID, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 34/47] ivshmem-server: fix hugetlbfs support, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 31/47] contrib: add ivshmem client and server, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 35/47] docs: update ivshmem device spec, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 37/47] contrib: remove unnecessary strdup(),
marcandre . lureau <=
- [Qemu-devel] [PATCH v4 38/47] msix: implement pba write (but read-only), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 36/47] ivshmem: add check on protocol version in QEMU, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 39/47] qtest: add qtest_add_abrt_handler(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 40/47] tests: add ivshmem qtest, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 41/47] ivshmem: do not keep shm_fd open, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 42/47] ivshmem: use strtosz(), marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 44/47] ivshmem: remove EventfdEntry.vector, marcandre . lureau, 2015/09/24
- [Qemu-devel] [PATCH v4 43/47] ivshmem: add hostmem backend, marcandre . lureau, 2015/09/24