vfb: use calloc() instead of malloc()
Using calloc() instead of malloc() as preventive measure, so there never can be any hidden bugs or leaks due uninitialized memory. The extra cost of using this compiler intrinsic should be practically impossible to measure - in many cases a good compiler can even deduce if certain areas really don't need to be zero'd (because they're written to right after allocation) and create more efficient machine code. The code pathes in question are pretty cold anyways, so it's probably not worth even thinking about potential extra runtime costs. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
30d65cd9f1
commit
a83f56eb92
|
@ -692,7 +692,7 @@ vfbAllocateFramebufferMemory(vfbScreenInfoPtr pvfb)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case NORMAL_MEMORY_FB:
|
case NORMAL_MEMORY_FB:
|
||||||
pvfb->pXWDHeader = (XWDFileHeader *) malloc(pvfb->sizeInBytes);
|
pvfb->pXWDHeader = (XWDFileHeader *) calloc(1, pvfb->sizeInBytes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue