sapling/hgext/extlib/cstore
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
..
datapackstore.cpp datapackstore: use C++11-compatible chrono code 2018-06-14 06:23:26 -07:00
datapackstore.h ensure that DatapackStore::markForRefresh() actually refreshes the store 2018-06-13 19:39:12 -07:00
datastore.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
deltachain.cpp hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
deltachain.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
key.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
match.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
py-cdatapack.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
py-cstore.cpp hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
py-datapackstore.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
py-structs.h hg: remove extra semicolons in structs 2018-04-13 21:51:51 -07:00
py-treemanifest.h fix bug in py-cstore code deleting unallocated memory 2018-07-24 09:32:02 -07:00
pythondatastore.cpp hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
pythondatastore.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
pythonkeyiterator.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
pythonutil.cpp hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
pythonutil.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
store.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
uniondatapackstore.cpp hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
uniondatapackstore.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00
util.h hg: disable check-code tests for C code 2018-06-05 19:21:43 -07:00