sapling/hgext/extlib
Adam Simpkins 49b000422f fix bug in py-cstore code deleting unallocated memory
Summary:
Fix subtreeiter_create() to avoid calling the `SubtreeIterator` destructor on
an object that it never constructed.

If an error is thrown constructing the `cmpNodes` vector or calling the
`SubtreeIterator` constructor, then the `SubtreeIterator` destructor should
not be called.  However, the `subtreeiter_create()` previously used
`Py_DECREF` to clean up the object, which always invoked
`subtreeiter_dealloc()` and called the `SubtreeIterator` destructor.

It looks like a lot of the other python object types declared in this file
have similar problems, and may incorrectly invoke C++ destructors on objects
that were never constructed if something goes wrong during object
initialization.  I have not fixed the other types yet as part of this diff.
The initialization logic for each type looks somewhat different, so they will
each need different fixes rather than this simple change of just calling
`PyObject_Del()` rather than `Py_DECREF()`.

Reviewed By: quark-zju

Differential Revision: D8963858

fbshipit-source-id: d610cac16133a7ff2350c17b13b5ebc7b7becc29
2018-07-24 09:32:02 -07:00
..
cfastmanifest hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
cstore fix bug in py-cstore code deleting unallocated memory 2018-07-24 09:32:02 -07:00
ctreemanifest treemanifest: change native tree walking to allow depth a parameter 2018-06-27 18:06:13 -07:00
indexes cleanup: remove Cargo.lock from check-in 2018-04-21 03:42:58 -07:00
phabricator codemod: reformat rest of the code 2018-07-05 17:52:43 -07:00
pyrevisionstore datapack: add python datapack wrapper 2018-07-17 15:10:01 -07:00
pywatchman codemod: reformat rest of the code 2018-07-05 17:52:43 -07:00
watchmanclient Speed up hg status by using the fsmonitor.sockpath from the config 2018-06-25 03:51:24 -07:00
__init__.py codemod: reformat rest of the code 2018-07-05 17:52:43 -07:00
cfastmanifest.c hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
linelog.pyx hg: basic support for building hg using buck 2018-04-13 21:50:58 -07:00
litemmap.pyx basepack: workaround Python's mmap fd limit 2018-04-13 21:51:00 -07:00
mysqlutil.py mysqlutil: new utility for mysql 2018-07-13 09:36:52 -07:00
README.md READMEs: tweaks based on feedback 2018-01-12 12:35:52 -08:00
traceprofimpl.cpp hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00

extlib

Code that extensions depend on, but aren't themselves extensions, should go here. Both native (C/C++/Cython/Rust) and Python code is allowed. Code that depends on Python is also allowed.

In theory, this code should slowly disappear as extension code gets folded into mainline Mercurial. (The native bits should go into lib/ or mercurial/cext), the Python code into mercurial/ itself.)

See also lib/README.md, mercurial/cext/README.md.