Mercurial > vim
changeset 3824:2bf8c00741f7 v7.3.670
updated for version 7.3.670
Problem: Python: memory leaks when there are exceptions.
Solution: Add DICTKEY_UNREF in the right places. (ZyX)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 21 Sep 2012 13:43:14 +0200 |
parents | 1280c67eb433 |
children | f0a177febcf3 |
files | src/if_py_both.h src/version.c |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;