]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.670 v7.3.670
authorBram Moolenaar <Bram@vim.org>
Fri, 21 Sep 2012 11:43:14 +0000 (13:43 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 21 Sep 2012 11:43:14 +0000 (13:43 +0200)
Problem:    Python: memory leaks when there are exceptions.
Solution:   Add DICTKEY_UNREF in the right places. (ZyX)

src/if_py_both.h
src/version.c

index 5e12638f5e4a4a2bb38da11186089edc297b26f3..c8a7fca7f8d1bc6aaa2efa36adefccc2dcd99939 100644 (file)
@@ -799,14 +799,14 @@ DictionaryItem(PyObject *self, PyObject *keyObject)
 
     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, PyObject *keyObject, PyObject *valObject)
 
        if (di == NULL)
        {
+           DICTKEY_UNREF
            PyErr_SetString(PyExc_IndexError, _("no such key in dictionary"));
            return -1;
        }
@@ -859,6 +860,7 @@ DictionaryAssItem(PyObject *self, PyObject *keyObject, PyObject *valObject)
 
        if (dict_add(d, di) == FAIL)
        {
+           DICTKEY_UNREF
            vim_free(di);
            PyErr_SetVim(_("failed to add key to dictionary"));
            return -1;
index 6ac25907c23a7f8b9cdcfed266da872c45e1b93b..4fb2743957480fbb55940b9a086f200b2e0872c6 100644 (file)
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    670,
 /**/
     669,
 /**/