[FcStrBuf] better handle malloc failure
If buffer has failed allocation, return NULL when done.
This commit is contained in:
parent
ced38254b4
commit
dccbbe83ef
|
@ -733,6 +733,9 @@ FcStrBufDone (FcStrBuf *buf)
|
|||
{
|
||||
FcChar8 *ret;
|
||||
|
||||
if (buf->failed)
|
||||
ret = NULL;
|
||||
else
|
||||
ret = malloc (buf->len + 1);
|
||||
if (ret)
|
||||
{
|
||||
|
@ -752,6 +755,9 @@ FcStrBufChar (FcStrBuf *buf, FcChar8 c)
|
|||
FcChar8 *new;
|
||||
int size;
|
||||
|
||||
if (buf->failed)
|
||||
return FcFalse;
|
||||
|
||||
if (buf->allocated)
|
||||
{
|
||||
size = buf->size * 2;
|
||||
|
|
Loading…
Reference in New Issue