]> granicus.if.org Git - python/commitdiff
bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref object...
authorXiang Zhang <angwerzx@126.com>
Mon, 20 Feb 2017 06:32:53 +0000 (14:32 +0800)
committerGitHub <noreply@github.com>
Mon, 20 Feb 2017 06:32:53 +0000 (14:32 +0800)
Misc/NEWS
Objects/weakrefobject.c

index f0ba8c621345bf440ddf88d6d7973f3588300c5e..8726996a4bc18c49b84b14ab4d864f7e1fa168d6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 2.7.14?
 Core and Builtins
 -----------------
 
+- bpo-29347: Fixed possibly dereferencing undefined pointers
+  when creating weakref objects.
+
 - Issue #14376: Allow sys.exit to accept longs as well as ints. Patch
   by Gareth Rees.
 
index c8b982fcd59ce823b3f9bc0e81e707fd58c1a014..2eb4fe0b17fbf043ceba8f6928391bb91e4eeb60 100644 (file)
@@ -24,6 +24,8 @@ init_weakref(PyWeakReference *self, PyObject *ob, PyObject *callback)
 {
     self->hash = -1;
     self->wr_object = ob;
+    self->wr_prev = NULL;
+    self->wr_next = NULL;
     Py_XINCREF(callback);
     self->wr_callback = callback;
 }