Skip to content

Commit 45b00c4

Browse files
committed
contrib: remove unnecessary strdup()
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 <[email protected]> Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
1 parent 5105b1d commit 45b00c4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

contrib/ivshmem-client/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ivshmem_client_parse_args(IvshmemClientArgs *args, int argc, char *argv[])
5353
break;
5454

5555
case 'S': /* unix_sock_path */
56-
args->unix_sock_path = strdup(optarg);
56+
args->unix_sock_path = optarg;
5757
break;
5858

5959
default:

contrib/ivshmem-server/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ ivshmem_server_parse_args(IvshmemServerArgs *args, int argc, char *argv[])
9292
break;
9393

9494
case 'p': /* pid_file */
95-
args->pid_file = strdup(optarg);
95+
args->pid_file = optarg;
9696
break;
9797

9898
case 'S': /* unix_socket_path */
99-
args->unix_socket_path = strdup(optarg);
99+
args->unix_socket_path = optarg;
100100
break;
101101

102102
case 'm': /* shm_path */
103-
args->shm_path = strdup(optarg);
103+
args->shm_path = optarg;
104104
break;
105105

106106
case 'l': /* shm_size */

0 commit comments

Comments
 (0)