Browse files

tre-python.c: raise PyErr_NoMem when appropriate.

  • Loading branch information...
1 parent 64755c3 commit 8a4c5b665a2d8d23d81ac42237e855a45e9a3595 @avm committed with Jul 11, 2010
Showing with 5 additions and 8 deletions.
  1. +5 −8 python/tre-python.c
View
13 python/tre-python.c
@@ -347,18 +347,15 @@ PyTrePattern_search(TrePatternObject *self, PyObject *args)
nsub = self->rgx.re_nsub + 1;
pm = PyMem_New(regmatch_t, nsub);
- if (pm != NULL)
+ if (!pm)
{
- mo->am.nmatch = nsub;
- mo->am.pmatch = pm;
- }
- else
- {
- /* XXX */
Py_DECREF(mo);
- return NULL;
+ return PyErr_NoMemory();
}
+ mo->am.nmatch = nsub;
+ mo->am.pmatch = pm;
+
targ = PyString_AsString(pstring);
tlen = PyString_Size(pstring);

0 comments on commit 8a4c5b6

Please sign in to comment.