mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
coverity: helping coverity with NULL pointer
Helping with understanding we will not try to deref NULL pointer, as if the sizes are initialized to NULL it also means 'mem' would be NULL, but thats too hard to model so make it obvious.
This commit is contained in:
parent
85a593c191
commit
2988fa3c21
@ -366,9 +366,9 @@ int buffer_append(struct buffer *buf, const char *string)
|
||||
{
|
||||
int len = strlen(string);
|
||||
|
||||
if ((buf->allocated - buf->used <= len) &&
|
||||
if ((!buf->mem || (buf->allocated - buf->used <= len)) &&
|
||||
!buffer_realloc(buf, len + 1))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
strcpy(buf->mem + buf->used, string);
|
||||
buf->used += len;
|
||||
|
Loading…
Reference in New Issue
Block a user