From owner-svn-src-all@freebsd.org Tue Feb 11 05:11:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E322F24E587; Tue, 11 Feb 2020 05:11:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48GrTr5f5Sz4VFy; Tue, 11 Feb 2020 05:11:28 +0000 (UTC) (envelope-from markj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD0012D1A; Tue, 11 Feb 2020 05:11:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 01B5BSSs091017; Tue, 11 Feb 2020 05:11:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 01B5BSVP091015; Tue, 11 Feb 2020 05:11:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202002110511.01B5BSVP091015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 11 Feb 2020 05:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r357751 - stable/12/contrib/elftoolchain/libelftc X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/contrib/elftoolchain/libelftc X-SVN-Commit-Revision: 357751 X-SVN-Commit-Repository: base 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.29 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: Tue, 11 Feb 2020 05:11:29 -0000 Author: markj Date: Tue Feb 11 05:11:27 2020 New Revision: 357751 URL: https://svnweb.freebsd.org/changeset/base/357751 Log: MFC r357535, r357536: libelftc: Fix memory leaks in the C++ demanglers. Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c ============================================================================== --- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Tue Feb 11 04:05:45 2020 (r357750) +++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Tue Feb 11 05:11:27 2020 (r357751) @@ -203,11 +203,13 @@ cpp_demangle_ARM(const char *org) break; if ((arg = vector_str_substr(&d.vec, arg_begin, d.vec.size - 1, - &arg_len)) == NULL) + &arg_len)) == NULL) goto clean; - if (vector_str_push(&d.arg, arg, arg_len) == false) + if (vector_str_push(&d.arg, arg, arg_len) == false) { + free(arg); goto clean; + } free(arg); @@ -301,12 +303,11 @@ init_demangle_data(struct demangle_data *d) d->type = ENCODE_FUNC; - if (vector_str_init(&d->vec) == false) + if (!vector_str_init(&d->vec)) return (false); - if (vector_str_init(&d->arg) == false) { + if (!vector_str_init(&d->arg)) { vector_str_dest(&d->vec); - return (false); } @@ -956,7 +957,7 @@ read_op_user(struct demangle_data *d) goto clean; if (VEC_PUSH_STR(&d->vec, "::operator ") == false) - return (false); + goto clean; if (vector_str_push(&d->vec, to_str, to_len) == false) goto clean; Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c ============================================================================== --- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Tue Feb 11 04:05:45 2020 (r357750) +++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Tue Feb 11 05:11:27 2020 (r357751) @@ -216,11 +216,13 @@ cpp_demangle_gnu2(const char *org) break; if ((arg = vector_str_substr(&d.vec, arg_begin, d.vec.size - 1, - &arg_len)) == NULL) + &arg_len)) == NULL) goto clean; - if (vector_str_push(&d.arg, arg, arg_len) == false) + if (vector_str_push(&d.arg, arg, arg_len) == false) { + free(arg); goto clean; + } free(arg); @@ -387,12 +389,11 @@ init_demangle_data(struct demangle_data *d) d->type = ENCODE_FUNC; - if (vector_str_init(&d->vec) == false) + if (!vector_str_init(&d->vec)) return (false); - if (vector_str_init(&d->arg) == false) { + if (!vector_str_init(&d->arg)) { vector_str_dest(&d->vec); - return (false); } Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c ============================================================================== --- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Tue Feb 11 04:05:45 2020 (r357750) +++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Tue Feb 11 05:11:27 2020 (r357751) @@ -1659,7 +1659,8 @@ cpp_demangle_read_local_name(struct cpp_demangle_data if (*(++ddata->cur) == '\0') return (0); - vector_str_init(&local_name); + if (!vector_str_init(&local_name)) + return (0); ddata->cur_output = &local_name; if (!cpp_demangle_read_encoding(ddata)) { @@ -3953,7 +3954,7 @@ vector_type_qualifier_init(struct vector_type_qualifie assert(v->q_container != NULL); - if (vector_str_init(&v->ext_name) == false) { + if (!vector_str_init(&v->ext_name)) { free(v->q_container); return (0); }