Coverity: Fix CID1393978
Fix a typo. Only memcpy into target buffer if pointer is not NULL. Change-Id: I1aa4b2ce1843e53ab6ed2224eaa928fc79ea3b83 Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/27446 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
This commit is contained in:
parent
679d624fae
commit
f4d81e0385
1 changed files with 1 additions and 1 deletions
|
@ -519,7 +519,7 @@ int bdk_device_add(bdk_node_t node, int ecam, int bus, int dev, int func)
|
||||||
{
|
{
|
||||||
int grow = device_list_max + DEVICE_GROW;
|
int grow = device_list_max + DEVICE_GROW;
|
||||||
bdk_device_t *tmp = malloc(grow * sizeof(bdk_device_t));
|
bdk_device_t *tmp = malloc(grow * sizeof(bdk_device_t));
|
||||||
if (!tmp)
|
if (tmp)
|
||||||
memcpy(tmp, device_list, device_list_max * sizeof(bdk_device_t));
|
memcpy(tmp, device_list, device_list_max * sizeof(bdk_device_t));
|
||||||
free(device_list);
|
free(device_list);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
|
|
Loading…
Reference in a new issue