Fix a potential crash

This commit is contained in:
Jan Vidar Krey 2010-04-21 18:34:39 +02:00
parent c82f8ba167
commit b6fb2b41bd
1 changed files with 9 additions and 8 deletions

View File

@ -235,16 +235,17 @@ struct adc_message* adc_msg_copy(const struct adc_message* cmd)
copy->feature_cast_include = 0;
copy->feature_cast_exclude = 0;
if (cmd->cache)
{
if (!adc_msg_grow(copy, copy->length))
{
adc_msg_free(copy);
return NULL; /* OOM */
}
if (!copy->cache)
return NULL;
memcpy(copy->cache, cmd->cache, cmd->length);
copy->cache[copy->length] = 0;
}
if (cmd->feature_cast_include)
{