From owner-svn-src-head@freebsd.org Sat Dec 10 23:58:15 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5430BC718EB; Sat, 10 Dec 2016 23:58:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23F671A60; Sat, 10 Dec 2016 23:58:15 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBANwE6k020420; Sat, 10 Dec 2016 23:58:14 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBANwE7g020419; Sat, 10 Dec 2016 23:58:14 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612102358.uBANwE7g020419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 10 Dec 2016 23:58:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309840 - head/sbin/camcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2016 23:58:15 -0000 Author: ngie Date: Sat Dec 10 23:58:14 2016 New Revision: 309840 URL: https://svnweb.freebsd.org/changeset/base/309840 Log: Cut to the chase and just call free instead of free(x) + x = NULL NULLing out x wasn't required as the memory was immediately scribbled over with strdup in the following call. MFC after: 1 week Submitted by: imp Modified: head/sbin/camcontrol/timestamp.c Modified: head/sbin/camcontrol/timestamp.c ============================================================================== --- head/sbin/camcontrol/timestamp.c Sat Dec 10 23:26:34 2016 (r309839) +++ head/sbin/camcontrol/timestamp.c Sat Dec 10 23:58:14 2016 (r309840) @@ -336,11 +336,6 @@ timestamp(struct cam_device *device, int int single_arg = 0; int do_utc = 0; -#define FREE(x) do { \ - free(x); \ - x = NULL; \ -} while(0) - while ((c = getopt(argc, argv, combinedopt)) != -1) { switch (c) { case 'r': { @@ -363,7 +358,7 @@ timestamp(struct cam_device *device, int } case 'f': { single_arg++; - FREE(format_string); + free(format_string); format_string = strdup(optarg); if (format_string == NULL) { warn("Error allocating memory for format " @@ -375,7 +370,7 @@ timestamp(struct cam_device *device, int } case 'm': { single_arg++; - FREE(format_string); + free(format_string); format_string = strdup(MIL); if (format_string == NULL) { warn("Error allocating memory"); @@ -389,7 +384,7 @@ timestamp(struct cam_device *device, int break; } case 'T': - FREE(timestamp_string); + free(timestamp_string); timestamp_string = strdup(optarg); if (timestamp_string == NULL) { warn("Error allocating memory for format " @@ -403,8 +398,6 @@ timestamp(struct cam_device *device, int } } -#undef FREE - if (action == -1) { warnx("Must specify an action, either -r or -s"); error = 1;