-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/cgo: panic if C.CString can't allocate memory #3403
Labels
Milestone
Comments
Not sure about this. C.malloc is an ordinary function, so it's hard to make that one panic. It's difficult to see why C.CString should be different. FWIW, you're on Linux so it will never happen anyway. Labels changed: added priority-later, removed priority-triage. Status changed to Thinking. |
This issue was closed by revision 397ba2c. Status changed to Fixed. |
The definition of Cmalloc, http://code.google.com/p/go/source/browse/src/cmd/cgo/out.go?spec=svn46fd4ef6c0deeb184aa0b843dfc080cc869a7e19&name=46fd4ef6c0de&r=46fd4ef6c0deeb184aa0b843dfc080cc869a7e19#1226 assumes a NULL return from malloc() means it's out of memory, but NULL is a valid return for malloc(0). Perhaps Cmalloc will never be called for zero bytes of memory and this isn't an issue, but I thought it worth checking. If Cmalloc(0) isn't possible, a comment to that affect would stop future readers wondering. |
Thank you for the reminder; how quickly we forget. Filed issue #6390 |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: