diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-10-12 03:04:18 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-10-12 03:04:18 (GMT) |
commit | a7d329a9b2d01895cb2e6b695ead74855bfeb02a (patch) | |
tree | f7cdd83e6a015383b1a96e594a6e22350f4540bf /Parser | |
parent | e545ff30a629f9d41a15c409ed9780eaf505b329 (diff) | |
download | cpython-a7d329a9b2d01895cb2e6b695ead74855bfeb02a.zip cpython-a7d329a9b2d01895cb2e6b695ead74855bfeb02a.tar.gz cpython-a7d329a9b2d01895cb2e6b695ead74855bfeb02a.tar.bz2 |
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/pgen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Parser/pgen.c b/Parser/pgen.c index dfe7cac..76cb204 100644 --- a/Parser/pgen.c +++ b/Parser/pgen.c @@ -124,7 +124,7 @@ addnfa(nfagrammar *gr, char *name) nf = newnfa(name); gr->gr_nfa = (nfa **)PyObject_REALLOC(gr->gr_nfa, - sizeof(nfa) * (gr->gr_nnfas + 1)); + sizeof(nfa*) * (gr->gr_nnfas + 1)); if (gr->gr_nfa == NULL) Py_FatalError("out of mem"); gr->gr_nfa[gr->gr_nnfas++] = nf; @@ -487,6 +487,7 @@ makedfa(nfagrammar *gr, nfa *nf, dfa *d) convert(d, xx_nstates, xx_state); /* XXX cleanup */ + PyObject_FREE(xx_state); } static void |