lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1354113 - /lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp
Date Tue, 26 Jun 2012 17:13:57 GMT
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);



Mime
View raw message