Skip to content

Commit f19669f

Browse files
committed
unaccent: Fix allocation size for target characters on initial load
This led to an overestimation of the size allocated for both the quoted and non-quoted cases, while using an inconsistent style. Thinkos in 59f47fb. Per report from Coverity, with extra input from Tom Lane.
1 parent 1f9e3a9 commit f19669f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/unaccent/unaccent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ initTrie(const char *filename)
238238
if (trgquoted && state > 0)
239239
{
240240
/* Ignore first and end quotes */
241-
trgstore = palloc0(sizeof(char *) * trglen - 2);
241+
trgstore = (char *) palloc(sizeof(char) * (trglen - 2));
242242
trgstorelen = 0;
243243
for (int i = 1; i < trglen - 1; i++)
244244
{
@@ -251,7 +251,7 @@ initTrie(const char *filename)
251251
}
252252
else
253253
{
254-
trgstore = palloc0(sizeof(char *) * trglen);
254+
trgstore = (char *) palloc(sizeof(char) * trglen);
255255
trgstorelen = trglen;
256256
memcpy(trgstore, trg, trgstorelen);
257257
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy