Added missing checks in strdup'ed strings.

This commit is contained in:
Fotis Panagiotopoulos 2023-04-12 17:23:56 +03:00 committed by Xiang Xiao
parent 098b7bbfb3
commit ab1b3c0337
2 changed files with 9 additions and 0 deletions

View File

@ -3506,6 +3506,12 @@ FAR void *gs2200m_register(FAR const char *devpath,
nxmutex_init(&dev->dev_lock);
if (!dev->path)
{
wlerr("Failed to allocate driver path.\n");
goto errout;
}
ret = gs2200m_initialize(dev, lower);
if (ret < 0)
{
@ -3531,6 +3537,7 @@ FAR void *gs2200m_register(FAR const char *devpath,
errout:
nxmutex_destroy(&dev->dev_lock);
lib_free(dev->path);
kmm_free(dev);
return NULL;
}

View File

@ -1093,6 +1093,8 @@ nxffs_setupwriter(FAR struct nxffs_volume_s *volume,
pack->dest.entry.utc = wrfile->ofile.entry.utc;
pack->dest.entry.datlen = wrfile->ofile.entry.datlen;
DEBUGASSERT(pack->dest.entry.name != NULL);
memset(&pack->src, 0, sizeof(struct nxffs_packstream_s));
memcpy(&pack->src.entry, &wrfile->ofile.entry,
sizeof(struct nxffs_entry_s));