You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2012/06/26 19:13:57 UTC

svn commit: r1354113 - /lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp

Author: vajda
Date: Tue Jun 26 17:13:56 2012
New Revision: 1354113

URL: http://svn.apache.org/viewvc?rev=1354113&view=rev
Log:
fixed small memory leak in error case

Modified:
    lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp

Modified: lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp?rev=1354113&r1=1354112&r2=1354113&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp Tue Jun 26 17:13:56 2012
@@ -476,17 +476,18 @@ _DLL_EXPORT PyObject *initVM(PyObject *s
                         add_option("", option, &vm_options[nOptions++]);
                     else
                     {
-                        for (unsigned int i = 0; i < nOptions; i++)
-                            delete vm_options[i].optionString;
+                        for (unsigned int j = 0; j < nOptions; j++)
+                            delete vm_options[j].optionString;
                         PyErr_Format(PyExc_ValueError,
                                      "Too many options (> %d)", nOptions);
+                        Py_DECREF(fast);
                         return NULL;
                     }
                 }
                 else
                 {
-                    for (unsigned int i = 0; i < nOptions; i++)
-                        delete vm_options[i].optionString;
+                    for (unsigned int j = 0; j < nOptions; j++)
+                        delete vm_options[j].optionString;
                     PyErr_Format(PyExc_TypeError,
                                  "vmargs arg %d is not a string", i);
                     Py_DECREF(fast);