##// END OF EJS Templates
parsers.c: fix a couple of memory leaks
Danek Duvall -
r21730:8da10038 stable
parent child Browse files
Show More
@@ -1299,7 +1299,7 b' static PyObject *find_deepest(indexObjec'
1299 static const Py_ssize_t capacity = 24;
1299 static const Py_ssize_t capacity = 24;
1300 int *depth, *interesting = NULL;
1300 int *depth, *interesting = NULL;
1301 int i, j, v, ninteresting;
1301 int i, j, v, ninteresting;
1302 PyObject *dict = NULL, *keys;
1302 PyObject *dict = NULL, *keys = NULL;
1303 long *seen = NULL;
1303 long *seen = NULL;
1304 int maxrev = -1;
1304 int maxrev = -1;
1305 long final;
1305 long final;
@@ -1403,8 +1403,10 b' static PyObject *find_deepest(indexObjec'
1403 final |= i;
1403 final |= i;
1404 j -= 1;
1404 j -= 1;
1405 }
1405 }
1406 if (final == 0)
1406 if (final == 0) {
1407 return PyList_New(0);
1407 keys = PyList_New(0);
1408 goto bail;
1409 }
1408
1410
1409 dict = PyDict_New();
1411 dict = PyDict_New();
1410 if (dict == NULL)
1412 if (dict == NULL)
@@ -1428,19 +1430,13 b' static PyObject *find_deepest(indexObjec'
1428
1430
1429 keys = PyDict_Keys(dict);
1431 keys = PyDict_Keys(dict);
1430
1432
1431 free(depth);
1432 free(seen);
1433 free(interesting);
1434 Py_DECREF(dict);
1435
1436 return keys;
1437 bail:
1433 bail:
1438 free(depth);
1434 free(depth);
1439 free(seen);
1435 free(seen);
1440 free(interesting);
1436 free(interesting);
1441 Py_XDECREF(dict);
1437 Py_XDECREF(dict);
1442
1438
1443 return NULL;
1439 return keys;
1444 }
1440 }
1445
1441
1446 /*
1442 /*
General Comments 0
You need to be logged in to leave comments. Login now