diff --git a/adapter/khdf/linux/model/camera/src/camera_buffer_manager_adapter.c b/adapter/khdf/linux/model/camera/src/camera_buffer_manager_adapter.c index 0c28d6f10b06c03c162bfd65700ac5341e472da7..3bee93f79a63b756548e86a1e652ee234a07dae9 100644 --- a/adapter/khdf/linux/model/camera/src/camera_buffer_manager_adapter.c +++ b/adapter/khdf/linux/model/camera/src/camera_buffer_manager_adapter.c @@ -58,6 +58,9 @@ static void CommonVmOpen(struct vm_area_struct *vma) return; } struct VmareaHandler *handler = vma->vm_private_data; + if (handler == NULL || handler->refCount == NULL) { + return; + } refcount_inc(handler->refCount); } @@ -69,6 +72,10 @@ static void CommonVmClose(struct vm_area_struct *vma) } struct VmareaHandler *handler = vma->vm_private_data; + if (handler == NULL || handler->arg == NULL) { + return; + } + handler->free(handler->arg); } diff --git a/adapter/khdf/linux/model/camera/src/virtual_malloc.c b/adapter/khdf/linux/model/camera/src/virtual_malloc.c index 2d723b75ebff47b3972e4cb3e1ea2fa2e3e6f9a1..e33e3e0a753b7a6b629da4c1685e156ad842651e 100644 --- a/adapter/khdf/linux/model/camera/src/virtual_malloc.c +++ b/adapter/khdf/linux/model/camera/src/virtual_malloc.c @@ -24,6 +24,9 @@ struct VmallocBuffer { static void VmallocMmapFree(void *bufPriv) { struct VmallocBuffer *buf = bufPriv; + if (buf == NULL) { + return; + } if (refcount_dec_and_test(&buf->refCount) != 0) { vfree(buf->vaddr); diff --git a/adapter/khdf/liteos/model/storage/src/mtd/mtd_char_lite.c b/adapter/khdf/liteos/model/storage/src/mtd/mtd_char_lite.c index 5decd9bd7f16d99a8dfb83bfcd6cdd82dd7595a9..040d92fd9fdcd1b9d6af3995b0c1de76914690d1 100644 --- a/adapter/khdf/liteos/model/storage/src/mtd/mtd_char_lite.c +++ b/adapter/khdf/liteos/model/storage/src/mtd/mtd_char_lite.c @@ -98,6 +98,9 @@ static int MtdCharClose(FAR struct file *filep) struct drv_data *drv = (struct drv_data *)filep->f_vnode->data; mtd_partition *partition = (mtd_partition *)drv->priv; struct MtdFileInfo *mfi = (struct MtdFileInfo *)(filep->f_priv); + if (mfi == NULL) { + return EFAIL; + } (void)LOS_MuxLock(&partition->lock, LOS_WAIT_FOREVER);