hun#2005643 tidy string functions

This commit is contained in:
Caolán McNamara 2010-03-04 13:29:16 +00:00
parent ea3a92e522
commit a10d892e2b
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
2010-03-04 Caolán McNamara <cmc at OOo>: 2010-03-04 Caolán McNamara <cmc at OOo>:
* hun#1724558 tidy substring.c a little * hun#1724558 tidy substring.c a little
* hun#1999737 add some malloc checks * hun#1999737 add some malloc checks
* hun#2005643 tidy string functions
2010-02-23 László Németh <nemeth at OOo>: 2010-02-23 László Németh <nemeth at OOo>:
* hyphen.c: fix lefthyphenmin calculation for UTF-8 encoded input * hyphen.c: fix lefthyphenmin calculation for UTF-8 encoded input

View File

@ -42,9 +42,9 @@ char * mystrdup(const char * s)
{ {
char * d = NULL; char * d = NULL;
if (s) { if (s) {
int sl = strlen(s); int sl = strlen(s+1);
d = (char *) malloc(((sl+1) * sizeof(char))); d = (char *) malloc(sl);
if (d) memcpy(d,s,((sl+1)*sizeof(char))); if (d) memcpy(d,s,sl);
} }
return d; return d;
} }