Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 35895:fe4c627b2096 legacy-trunk
Fix a few more memory leaks
Document more info about the benefits of configuring without
pymalloc when running valgrind
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sun, 20 Nov 2005 23:58:38 +0000 |
| parents | 1f9d4ac35010 |
| children | c89707daa011 |
line wrap: on
line diff
--- a/Python/ast.c Sun Nov 20 00:24:18 2005 +0000 +++ b/Python/ast.c Sun Nov 20 23:58:38 2005 +0000 @@ -1054,8 +1054,12 @@ return NULL; } - if (asdl_seq_LEN(t) == 1) + if (asdl_seq_LEN(t) == 1) { lc = comprehension(asdl_seq_GET(t, 0), expression, NULL); + /* only free the sequence since we grabbed element 0 above */ + if (lc) + asdl_seq_free(t); /* ok */ + } else lc = comprehension(Tuple(t, Store, LINENO(ch)), expression, NULL); @@ -1222,9 +1226,13 @@ return NULL; } - if (asdl_seq_LEN(t) == 1) + if (asdl_seq_LEN(t) == 1) { ge = comprehension(asdl_seq_GET(t, 0), expression, NULL); + /* only free the sequence since we grabbed element 0 above */ + if (ge) + asdl_seq_free(t); /* ok */ + } else ge = comprehension(Tuple(t, Store, LINENO(ch)), expression, NULL);
