Free coding spec (cs) if there was an error to prevent mem leak. Maybe backport candidate

This commit is contained in:
Neal Norwitz 2005-10-21 06:05:33 +00:00
parent 1e8659b963
commit c0d5faa9b4

View file

@ -277,11 +277,14 @@ check_coding_spec(const char* line, int size, struct tok_state *tok,
tok->encoding = cs; tok->encoding = cs;
tok->decoding_state = -1; tok->decoding_state = -1;
} }
else
PyMem_DEL(cs);
#else #else
/* Without Unicode support, we cannot /* Without Unicode support, we cannot
process the coding spec. Since there process the coding spec. Since there
won't be any Unicode literals, that won't be any Unicode literals, that
won't matter. */ won't matter. */
PyMem_DEL(cs);
#endif #endif
} }
} else { /* then, compare cs with BOM */ } else { /* then, compare cs with BOM */