• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版6fa0bc1c30c6f099771d91c574cccbce5535ae75 (tree)
时间2019-09-24 22:06:32
作者Nick Alcock <nick.alcock@orac...>
CommiterNick Alcock

Log Message

libctf: fix refcount leak in ctf_import

Calling ctf_import (fp, NULL) to cancel out a pre-existing import leaked
the refcnt increment on the parent, so it could never be freed.

New in v4.

libctf/
* ctf-open.c (ctf_import): Do not leak a ctf_file_t ref on every
ctf_import after the first for a given file.

更改概述

差异

--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,5 +1,10 @@
11 2019-09-23 Nick Alcock <nick.alcock@oracle.com>
22
3+ * ctf-open.c (ctf_import): Do not leak a ctf_file_t ref on every
4+ ctf_import after the first for a given file.
5+
6+2019-09-23 Nick Alcock <nick.alcock@oracle.com>
7+
38 * ctf-impl.h (ctf_str_append_noerr): Declare.
49 * ctf-util.c (ctf_str_append_noerr): Define in terms of
510 ctf_str_append.
--- a/libctf/ctf-open.c
+++ b/libctf/ctf-open.c
@@ -1778,6 +1778,7 @@ ctf_import (ctf_file_t *fp, ctf_file_t *pfp)
17781778
17791779 if (fp->ctf_parent != NULL)
17801780 {
1781+ fp->ctf_parent->ctf_refcnt--;
17811782 ctf_file_close (fp->ctf_parent);
17821783 fp->ctf_parent = NULL;
17831784 }
@@ -1793,6 +1794,7 @@ ctf_import (ctf_file_t *fp, ctf_file_t *pfp)
17931794 fp->ctf_flags |= LCTF_CHILD;
17941795 pfp->ctf_refcnt++;
17951796 }
1797+
17961798 fp->ctf_parent = pfp;
17971799 return 0;
17981800 }