From patchwork Fri Jun 26 14:49:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 488891 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 56BA51400A0 for ; Sat, 27 Jun 2015 01:15:02 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=t4kUzd0S; dkim-atps=neutral Received: from localhost ([::1]:60633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8VLI-0004xK-D2 for incoming@patchwork.ozlabs.org; Fri, 26 Jun 2015 11:15:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Uyi-0006GF-Ma for qemu-devel@nongnu.org; Fri, 26 Jun 2015 10:51:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z8Uyg-0002o6-6J for qemu-devel@nongnu.org; Fri, 26 Jun 2015 10:51:40 -0400 Received: from mail-qk0-x22f.google.com ([2607:f8b0:400d:c09::22f]:35839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z8Uyg-0002o2-3F for qemu-devel@nongnu.org; Fri, 26 Jun 2015 10:51:38 -0400 Received: by qkbp125 with SMTP id p125so56302350qkb.2 for ; Fri, 26 Jun 2015 07:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=4FmWGRYMvNxTdVRzMRDdvCi/OqdI7iUfqrQtuDuH+jI=; b=t4kUzd0SQsUOqL67o6IMKHgJbwOtXrocpEfdIlFBQmoQwfRq8ZCYyLmqwFRwkLP8gy rRFs3NRwufovvteNFMVHqf/r9geLA88U+fZNwlk66ZiWx6Gl4G/9YRyYw0uhAhqLA9dW gVVe96+sLco+hFia4EDawWSUxqwSPOGc4c0CiaMRrci3o7ImEMCVVPWJ2lPcVHfBx962 t2ipUdEJkPfop90azgioFo8vK6H/tvGM+CZBmYRkTO2K5/mNW/FwdIPUEFQ+uAdzGU1+ kikRfEHSSTM1U/UPE+/Ih7s3bZDvkbzFIE31JG9ryhSZm7R1gXW4QNB6bmc4k3ysGS98 8lOw== X-Received: by 10.55.33.196 with SMTP id f65mr4660041qki.2.1435330297785; Fri, 26 Jun 2015 07:51:37 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by mx.google.com with ESMTPSA id b31sm6961788qge.5.2015.06.26.07.51.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2015 07:51:36 -0700 (PDT) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 26 Jun 2015 16:49:42 +0200 Message-Id: <1435330185-23248-37-git-send-email-marcandre.lureau@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1435330185-23248-1-git-send-email-marcandre.lureau@gmail.com> References: <1435330185-23248-1-git-send-email-marcandre.lureau@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c09::22f Cc: cam@cs.ualberta.ca, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , stefanha@redhat.com Subject: [Qemu-devel] [PATCH 36/39] contrib: remove unnecessary strdup() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 */