]> granicus.if.org Git - python/commitdiff
Free coding spec (cs) if there was an error to prevent mem leak. Maybe backport...
authorNeal Norwitz <nnorwitz@gmail.com>
Fri, 21 Oct 2005 06:05:33 +0000 (06:05 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Fri, 21 Oct 2005 06:05:33 +0000 (06:05 +0000)
Parser/tokenizer.c

index ce613228dc8a5906ee72d5fc9fd59cb498fec9d7..5a9bcc04e7f4be12e2c3109bb41f29e1c69ecc18 100644 (file)
@@ -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 */