From owner-svn-src-all@freebsd.org Fri Mar 3 21:32:29 2017 Return-Path: Delivered-To: svn-src-all@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 3FB75CF77C2; Fri, 3 Mar 2017 21:32:29 +0000 (UTC) (envelope-from cy@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 05A1E1528; Fri, 3 Mar 2017 21:32:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v23LWSkH092062; Fri, 3 Mar 2017 21:32:28 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v23LWSlK092061; Fri, 3 Mar 2017 21:32:28 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201703032132.v23LWSlK092061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 3 Mar 2017 21:32:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314627 - head/contrib/ipfilter/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2017 21:32:29 -0000 Author: cy Date: Fri Mar 3 21:32:27 2017 New Revision: 314627 URL: https://svnweb.freebsd.org/changeset/base/314627 Log: Fix leak (free str before returning when ctx's calloc fails). Submitted by: trix_juniper.net (Tom Rix) Discovered by: clang's static analyzer MFC after: 4 days Relnotes: ngie Differential Revision: D9877 Modified: head/contrib/ipfilter/lib/save_v2trap.c Modified: head/contrib/ipfilter/lib/save_v2trap.c ============================================================================== --- head/contrib/ipfilter/lib/save_v2trap.c Fri Mar 3 21:03:28 2017 (r314626) +++ head/contrib/ipfilter/lib/save_v2trap.c Fri Mar 3 21:32:27 2017 (r314627) @@ -124,8 +124,10 @@ snmpv2_parse(char **strings) str = strdup(*strings); ctx = calloc(1, sizeof(*ctx)); - if (ctx == NULL) + if (ctx == NULL) { + free(str); return NULL; + } ctx->fd = -1;