Skip to content
New issue

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

Use calloc for ALLOCATE (the memory is set to zero) #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Use calloc for ALLOCATE (the memory is set to zero) #29

wants to merge 1 commit into from

Conversation

caramelli
Copy link

This can avoid a Segmentation fault when calling FREE, for example in vkDestroyDescriptorPool() if bufferDescriptorCPA has not been yet allocated.

Nicolas Caramelli

@Yours3lf
Copy link
Owner

sounds like a good debug option, I like it. I'd not merge it for release though

@caramelli
Copy link
Author

As you prefer, but this change is required for the triangle test to work on my system. Otherwise the triangle test can also be modified like proposed in #30

Nicolas Caramelli

@Yours3lf
Copy link
Owner

do you mean there's an issue if you don't zero out memory? sounds like you found a bug

@caramelli
Copy link
Author

Yes exactly, this is what I see in vkDestroyDescriptorPool() if bufferDescriptorCPA.buf has not yet been initialized to zero with the ALLOCATE in vkCreateDescriptorPool().
In the triangle test, a descriptor pool for VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER and VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER is created, so imageDescriptorCPA.buf and texelBufferDescriptorCPA.buf are valid. But this is not the case for bufferDescriptorCPA.buf.

Nicolas Caramelli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants