# HG changeset patch # User Bram Moolenaar # Date 1348227794 -7200 # Node ID 2bf8c00741f7f07d9b58596764236a92eaeca862 # Parent 1280c67eb433b262a1214b12c143c40b1b19cc9d updated for version 7.3.670 Problem: Python: memory leaks when there are exceptions. Solution: Add DICTKEY_UNREF in the right places. (ZyX) diff --git a/src/if_py_both.h b/src/if_py_both.h --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -799,14 +799,14 @@ DictionaryItem(PyObject *self, PyObject di = dict_find(((DictionaryObject *) (self))->dict, key, -1); + DICTKEY_UNREF + if (di == NULL) { PyErr_SetString(PyExc_IndexError, _("no such key in dictionary")); return NULL; } - DICTKEY_UNREF - return ConvertToPyObject(&di->di_tv); } @@ -835,6 +835,7 @@ DictionaryAssItem(PyObject *self, PyObje if (di == NULL) { + DICTKEY_UNREF PyErr_SetString(PyExc_IndexError, _("no such key in dictionary")); return -1; } @@ -859,6 +860,7 @@ DictionaryAssItem(PyObject *self, PyObje if (dict_add(d, di) == FAIL) { + DICTKEY_UNREF vim_free(di); PyErr_SetVim(_("failed to add key to dictionary")); return -1; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -720,6 +720,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 670, +/**/ 669, /**/ 668,