We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I've been reading the bam's source tree lately and noticed a bit strange pattern:
malloc
memset
calloc
For example:
bam/src/statcache.c
Lines 28 to 35 in a44a2c7
In this case sizeof(struct STATCACHE) is pretty big so calloc would be beneficial. (see https://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc ) Also, in OOM situation, this will corrupt memory and cause a crash later.
sizeof(struct STATCACHE)
Is there a reason for this? Are there any platforms that do not support calloc ?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I've been reading the bam's source tree lately and noticed a bit strange pattern:
malloc
is rarely being checked, neither in the place where the call happens nor somewhere else.malloc
+memset
is being used instead ofcalloc
For example:
bam/src/statcache.c
Lines 28 to 35 in a44a2c7
In this case
sizeof(struct STATCACHE)
is pretty big socalloc
would be beneficial.(see https://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc )
Also, in OOM situation, this will corrupt memory and cause a crash later.
Is there a reason for this? Are there any platforms that do not support
calloc
?The text was updated successfully, but these errors were encountered: