Fix some small memory leaks.

This commit is contained in:
Jan Vidar Krey
2010-04-21 18:34:55 +02:00
parent b6fb2b41bd
commit 076492f1b9
4 changed files with 15 additions and 22 deletions

View File

@@ -88,6 +88,9 @@ static int adc_msg_grow(struct adc_message* msg, size_t size)
char* buf;
size_t newsize = 0;
if (!msg)
return 0;
if (msg->capacity > size)
return 1;
@@ -242,7 +245,10 @@ struct adc_message* adc_msg_copy(const struct adc_message* cmd)
}
if (!copy->cache)
{
adc_msg_free(copy);
return NULL;
}
memcpy(copy->cache, cmd->cache, cmd->length);
copy->cache[copy->length] = 0;