mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Free coding spec (cs) if there was an error to prevent mem leak. Maybe backport candidate
This commit is contained in:
parent
1e8659b963
commit
c0d5faa9b4
1 changed files with 3 additions and 0 deletions
|
@ -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 */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue