hun#1999737 add some malloc checks

This commit is contained in:
Caolán McNamara 2010-03-04 13:08:22 +00:00
parent 7107dea0c0
commit e39ae52d7d
2 changed files with 15 additions and 12 deletions

View File

@ -1,5 +1,6 @@
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
2010-02-23 László Németh <nemeth at OOo>:
* hyphen.c: fix lefthyphenmin calculation for UTF-8 encoded input

View File

@ -20,18 +20,20 @@ char * mystrsep(char ** stringp, const char delim)
*stringp = dp+1;
nc = (int)((unsigned long)dp - (unsigned long)mp);
rv = (char *) malloc(nc+1);
if (rv) {
memcpy(rv,mp,nc);
*(rv+nc) = '\0';
return rv;
}
} else {
rv = (char *) malloc(n+1);
if (rv) {
memcpy(rv, mp, n);
*(rv+n) = '\0';
*stringp = mp + n;
}
}
}
return rv;
}
}
return NULL;
}