github.com/4ad/go@v0.0.0-20161219182952-69a12818b605/misc/cgo/test/issue6390.go (about)

     1  // Copyright 2013 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package cgotest
     6  
     7  // #include <stdlib.h>
     8  import "C"
     9  
    10  import "testing"
    11  
    12  func test6390(t *testing.T) {
    13  	p1 := C.malloc(1024)
    14  	if p1 == nil {
    15  		t.Fatalf("C.malloc(1024) returned nil")
    16  	}
    17  	p2 := C.malloc(0)
    18  	if p2 == nil {
    19  		t.Fatalf("C.malloc(0) returned nil")
    20  	}
    21  	C.free(p1)
    22  	C.free(p2)
    23  }