From patchwork Tue Sep 15 16:07:54 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: 518009 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 1CA05140285 for ; Wed, 16 Sep 2015 02:32:58 +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=hrySqqDU; dkim-atps=neutral Received: from localhost ([::1]:44382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbtA8-0002UN-38 for incoming@patchwork.ozlabs.org; Tue, 15 Sep 2015 12:32:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbsp2-0008Dq-F2 for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:11:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zbsoy-0006aY-GF for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:11:08 -0400 Received: from mail-qg0-x22e.google.com ([2607:f8b0:400d:c04::22e]:35709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbsoy-0006aM-3h for qemu-devel@nongnu.org; Tue, 15 Sep 2015 12:11:04 -0400 Received: by qgt47 with SMTP id 47so146963366qgt.2 for ; Tue, 15 Sep 2015 09:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=gHrDlsZtFta0eSxp7PCA1QHLYYl8K9TpAa3PQqYz3yk=; b=hrySqqDU6L1ZnT84XecRqNI0lJiqBpTWgIP9Huqjgx4YVaHXWOMBsawXJnqpVPKg5r vlRhZeIXeKSRuAsn5/hm6FHDVrOz1y/qVSE5hLVDKDl7ETUTEBiY2HPiaJmpttglHCJ5 q0KXb8eVhBAcmXQe8ojEIeqwXP74Nb/yjr0Ql8jK2q18tyL0rz79328OTLgNRjpl7bEF MPhvZnAvVFJlsgWh8wdPEB7mwbEYffkck3Q1J3rDVftZtptyk1xa1ggHExjhIRpNxRtF Z1MqKHJz8wngIlNzo++ArVCtQs367VyuZhFFe/4GLMR1V2Q50v1Fca/kcuH50KlI2P0F Bn/A== X-Received: by 10.140.132.71 with SMTP id 68mr35329659qhe.64.1442333463597; Tue, 15 Sep 2015 09:11:03 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id d1sm8237011qkh.25.2015.09.15.09.11.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 09:11:02 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Tue, 15 Sep 2015 18:07:54 +0200 Message-Id: <1442333283-13119-38-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1442333283-13119-1-git-send-email-marcandre.lureau@redhat.com> References: <1442333283-13119-1-git-send-email-marcandre.lureau@redhat.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:c04::22e Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , drjones@redhat.com, cam@cs.ualberta.ca, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v3 37/46] 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 From: Marc-André Lureau 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 Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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 */