diff options
author | Karl Williamson <khw@khw-desktop.(none)> | 2010-04-15 21:32:27 -0600 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-04-25 16:31:21 +0200 |
commit | 6e1bad6cc227c8e8bc81402ccd56b118e265a861 (patch) | |
tree | 129662b5977ce789c0379f47a643a6ae9751508d /toke.c | |
parent | a5ec937f8880d8e532d7ae121ac2dc6fc3e5fa9a (diff) | |
download | perl-6e1bad6cc227c8e8bc81402ccd56b118e265a861.tar.gz |
PATCH: memory leak introduced in 5.12.0
There is a small possibility of a memory leak in toke.c when there is a
deprecated character in the name in a \N{...} construct, and the Perl is
embedded or something like that so that memory isn't freed up when it
exits. This patch avoids the creation of a new scalar, and gives a
better error message besides.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -3264,14 +3264,11 @@ S_scan_const(pTHX_ char *start) } } if (problematic) { - char *string; - Newx(string, e - i + 1, char); - Copy(i, string, e - i, char); - string[e - i] = '\0'; + /* The e-i passed to the final %.*s makes sure that + * should the trailing NUL be missing that this + * print won't run off the end of the string */ Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), - "Deprecated character(s) in \\N{...} starting at '%s'", - string); - Safefree(string); + "Deprecated character in \\N{...}; marked by <-- HERE in \\N{%.*s<-- HERE %.*s", i - s + 1, s, e - i, i + 1); } } } /* End \N{NAME} */ |