1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvmetad: check result of buffer_realloc

This commit is contained in:
Zdenek Kabelac 2012-10-12 10:50:07 +02:00
parent c4dcbf67a3
commit 5c792f620b

View File

@ -289,8 +289,9 @@ int buffer_append(struct buffer *buf, const char *string)
{
int len = strlen(string);
if (buf->allocated - buf->used <= len)
buffer_realloc(buf, len + 1);
if ((buf->allocated - buf->used <= len) &&
!buffer_realloc(buf, len + 1))
return 0;
strcpy(buf->mem + buf->used, string);
buf->used += len;