Mercurial > cpython-lru_cache-weakref
diff Python/symtable.c @ 39445:e11caad7e029 legacy-trunk
Klocwork made another run and found a bunch more problems.
This is the first batch of fixes that should be easy to verify based on context.
This fixes problem numbers: 220 (ast), 323-324 (symtable),
321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sat, 12 Aug 2006 01:43:40 +0000 |
| parents | 75a7106662a3 |
| children | 2c4026769945 |
line wrap: on
line diff
--- a/Python/symtable.c Fri Aug 11 19:55:35 2006 +0000 +++ b/Python/symtable.c Sat Aug 12 01:43:40 2006 +0000 @@ -915,6 +915,8 @@ PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++st->st_cur->ste_tmpname); tmp = PyString_InternFromString(tmpname); + if (!tmp) + return 0; if (!symtable_add_def(st, tmp, DEF_LOCAL)) return 0; Py_DECREF(tmp); @@ -1323,8 +1325,11 @@ PyObject *name = (a->asname == NULL) ? a->name : a->asname; const char *base = PyString_AS_STRING(name); char *dot = strchr(base, '.'); - if (dot) + if (dot) { store_name = PyString_FromStringAndSize(base, dot - base); + if (!store_name) + return 0; + } else { store_name = name; Py_INCREF(store_name);
