From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id C6C9F381EC92; Thu, 8 Dec 2022 01:23:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C6C9F381EC92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670462604; bh=xOVPJ+EbTj911SmrTFRRwUpgRCzGDZHn09ZKVhsv/y4=; h=From:To:Subject:Date:From; b=XKMJligCySk1ifgaLwuua60Hd5S6rdtfj1AeaIihfhCXsKxlGdOdhQcH6OrpWni2h wKfyUpjarkQKiQfaN6x0Us9xA56Jhr7ndNYveQ2aWVCPuUVRN6GL9tXAe99HYYUOOv HTpQxOrEQhETiuTMlHhQMRBUUtVM9uxRi/T1iu4w= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] libctf: avoid potential double free X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: b0f110a5ea0914aff686bab0f511d749433104d8 X-Git-Newrev: 57336e2e4d05eaac6367400e6ce3aed24f838f2c Message-Id: <20221208012324.C6C9F381EC92@sourceware.org> Date: Thu, 8 Dec 2022 01:23:24 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D57336e2e4d05= eaac6367400e6ce3aed24f838f2c commit 57336e2e4d05eaac6367400e6ce3aed24f838f2c Author: Alan Modra Date: Thu Dec 8 11:45:12 2022 +1030 libctf: avoid potential double free =20 * ctf-link.c (ctf_link_add_cu_mapping): Set t NULL after free. Diff: --- libctf/ctf-link.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 702f2b4d5fe..902b4408cd6 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -431,7 +431,10 @@ ctf_link_add_cu_mapping (ctf_dict_t *fp, const char *f= rom, const char *to) } } else - free (t); + { + free (t); + t =3D NULL; + } =20 if (ctf_dynhash_insert (one_out, f, NULL) < 0) {