From: Neal Norwitz Date: Fri, 21 Oct 2005 06:05:33 +0000 (+0000) Subject: Free coding spec (cs) if there was an error to prevent mem leak. Maybe backport... X-Git-Tag: v2.5a0~1266 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c0d5faa9b4a763befbeab0159d2241a9ddf85b56;p=thirdparty%2FPython%2Fcpython.git Free coding spec (cs) if there was an error to prevent mem leak. Maybe backport candidate --- diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index ce613228dc8a..5a9bcc04e7f4 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -277,11 +277,14 @@ check_coding_spec(const char* line, int size, struct tok_state *tok, tok->encoding = cs; tok->decoding_state = -1; } + else + PyMem_DEL(cs); #else /* Without Unicode support, we cannot process the coding spec. Since there won't be any Unicode literals, that won't matter. */ + PyMem_DEL(cs); #endif } } else { /* then, compare cs with BOM */