drivers/memory_mminfo : Move heap Null check
WID:10614848 After having been assigned to NULL value at mminfo.c:83, pointer 'heap' is dereferenced at mminfo.c:126.
@@ -114,14 +114,14 @@ static int mminfo_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
#ifdef CONFIG_APP_BINARY_SEPARATION
case HEAPINFO_HEAP_TYPE_BINARY:
heap = mm_get_app_heap_with_name(option->app_name);
- if (heap == NULL) {
- return -EINVAL;
- }
break;
#endif
default:
break;
}
+ if (heap == NULL) {
+ return -EINVAL;
+ }
if (option->mode == HEAPINFO_INIT_PEAK) {
heap->peak_alloc_size = 0;
return OK;
