mirror of https://github.com/thesofproject/sof.git
alloc: fix two potential NULL dereferences
bzero() doesn't check its pointer argument for NULL, the caller has to avoid such calls. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
84d7eabde9
commit
5a9b8e7ee9
|
@ -597,9 +597,12 @@ void *_malloc(int zone, uint32_t caps, size_t bytes)
|
||||||
trace_mem_error("rmalloc() error: invalid zone");
|
trace_mem_error("rmalloc() error: invalid zone");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG_BLOCK_FREE
|
#if DEBUG_BLOCK_FREE
|
||||||
bzero(ptr, bytes);
|
if (ptr)
|
||||||
|
bzero(ptr, bytes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spin_unlock_irq(&memmap.lock, flags);
|
spin_unlock_irq(&memmap.lock, flags);
|
||||||
memmap.heap_trace_updated = 1;
|
memmap.heap_trace_updated = 1;
|
||||||
return ptr;
|
return ptr;
|
||||||
|
@ -691,7 +694,8 @@ out:
|
||||||
ptr = cache_to_uncache(ptr);
|
ptr = cache_to_uncache(ptr);
|
||||||
|
|
||||||
#if DEBUG_BLOCK_FREE
|
#if DEBUG_BLOCK_FREE
|
||||||
bzero(ptr, bytes);
|
if (ptr)
|
||||||
|
bzero(ptr, bytes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spin_unlock_irq(&memmap.lock, flags);
|
spin_unlock_irq(&memmap.lock, flags);
|
||||||
|
|
Loading…
Reference in New Issue