We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8200a9 commit c901870Copy full SHA for c901870
pkgui.h
@@ -3,6 +3,7 @@
3
#define pkguiHFileIncluded
4
5
#include <stdlib.h>
6
+#include <string.h>
7
#include <time.h>
8
#include "ui.h"
9
util.go
@@ -12,8 +12,10 @@ import "C"
12
//export pkguiAlloc
13
func pkguiAlloc(n C.size_t) unsafe.Pointer {
14
// cgo turns C.malloc() into a panic-on-OOM version; use it
15
- // TODO make sure it zero-initializes too
16
- return C.malloc(n)
+ ret := C.malloc(n)
+ // and this won't zero-initialize; do it ourselves
17
+ C.memset(ret, 0, n)
18
+ return ret
19
}
20
21
func freestr(str *C.char) {
0 commit comments