Skip to content

Commit 125d69c

Browse files
committed
Fix signed char in comparison and check memory allocation
1 parent ad8c09c commit 125d69c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

contrib/tsearch2/ispell/spell.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ strnduplicate(char *s, int len) {
4949
}
5050
/* backward string compaire for suffix tree operations */
5151
static int
52-
strbcmp(const char *s1, const char *s2)
52+
strbcmp(const unsigned char *s1, const unsigned char *s2)
5353
{
5454
int l1 = strlen(s1) - 1,
5555
l2 = strlen(s2) - 1;
@@ -71,7 +71,7 @@ strbcmp(const char *s1, const char *s2)
7171
return 0;
7272
}
7373
static int
74-
strbncmp(const char *s1, const char *s2, size_t count)
74+
strbncmp(const unsigned char *s1, const unsigned char *s2, size_t count)
7575
{
7676
int l1 = strlen(s1) - 1,
7777
l2 = strlen(s2) - 1,
@@ -536,9 +536,10 @@ mkANode(IspellDict *Conf, int low, int high, int level, int type) {
536536
}
537537
data->val=GETCHAR( Conf->Affix + i, level, type );
538538
if ( Conf->Affix[i].replen == level+1 ) { /* affix stopped */
539-
if ( !data->naff )
539+
if ( !data->naff ) {
540540
data->aff=(AFFIX**)malloc(sizeof(AFFIX*)*(high-i+1));
541-
MEMOUT(data);
541+
MEMOUT(data->aff);
542+
}
542543
data->aff[ data->naff ] = Conf->Affix + i;
543544
data->naff++;
544545
}

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