Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 150 for malloc (0.15 sec)

  1. src/cmd/cgo/internal/testerrors/testdata/malloc.go

    	// causes it to fail.
    	if runtime.GOOS == "dragonfly" {
    		size = C.size_t(0x7fffffff << (32 * (^uintptr(0) >> 63)))
    	}
    
    	p := C.malloc(size)
    	if p == nil {
    		fmt.Println("malloc: C.malloc returned nil")
    		// Just exit normally--the test script expects this
    		// program to crash, so exiting normally indicates failure.
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 766 bytes
    - Viewed (0)
  2. src/cmd/cgo/internal/testsanitizers/testdata/tsan4.go

    // Copyright 2016 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package main
    
    // Check that calls to C.malloc/C.free do not trigger TSAN false
    // positive reports.
    
    // #cgo CFLAGS: -fsanitize=thread
    // #cgo LDFLAGS: -fsanitize=thread
    // #include <stdlib.h>
    import "C"
    
    import (
    	"runtime"
    	"sync"
    )
    
    func main() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 634 bytes
    - Viewed (0)
  3. src/cmd/cgo/internal/testerrors/ptr_test.go

    		c: `#include <stdlib.h>
    		    char **f14a() { return malloc(sizeof(char*)); }
    		    void f14b(char **p) {}`,
    		body:      `p := C.f14a(); *p = new(C.char); C.f14b(p)`,
    		fail:      true,
    		expensive: true,
    	},
    	{
    		// Storing a pinned Go pointer into C memory should succeed.
    		name: "barrierpinnedok",
    		c: `#include <stdlib.h>
    		    char **f14a2() { return malloc(sizeof(char*)); }
    		    void f14b2(char **p) {}`,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 03 16:07:49 UTC 2023
    - 21.2K bytes
    - Viewed (0)
  4. src/cmd/cgo/internal/test/issue23555a/a.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package issue23555
    
    // #include <stdlib.h>
    import "C"
    
    func X() {
    	C.free(C.malloc(10))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 12:00:02 UTC 2023
    - 250 bytes
    - Viewed (0)
  5. src/cmd/cgo/internal/testerrors/testdata/issue18889.go

    package main
    
    import "C"
    
    func main() {
    	_ = C.malloc // ERROR HERE
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 70 bytes
    - Viewed (0)
  6. src/cmd/cgo/internal/testsanitizers/testdata/tsan5.go

    // Copyright 2016 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package main
    
    // Check that calls to C.malloc/C.free do not collide with the calls
    // made by the os/user package.
    
    // #cgo CFLAGS: -fsanitize=thread
    // #cgo LDFLAGS: -fsanitize=thread
    // #include <stdlib.h>
    import "C"
    
    import (
    	"fmt"
    	"os"
    	"os/user"
    	"runtime"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 927 bytes
    - Viewed (0)
  7. src/cmd/cgo/internal/testsanitizers/testdata/asan2_fail.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package main
    
    /*
    #include <stdlib.h>
    #include <stdio.h>
    
    int *p;
    int* f() {
      int i;
      p = (int *)malloc(5*sizeof(int));
      for (i = 0; i < 5; i++) {
        p[i] = i+10;
      }
      return p;
    }
    */
    import "C"
    import (
    	"fmt"
    	"unsafe"
    )
    
    func main() {
    	a := C.f()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 616 bytes
    - Viewed (0)
  8. src/cmd/cgo/internal/testsanitizers/testdata/msan2.go

    // license that can be found in the LICENSE file.
    
    package main
    
    /*
    #include <string.h>
    #include <stdint.h>
    #include <stdlib.h>
    
    void f(int32_t *p, int n) {
      int32_t * volatile q = (int32_t *)malloc(sizeof(int32_t) * n);
      memcpy(p, q, n * sizeof(*p));
      free(q);
    }
    
    void g(int32_t *p, int n) {
      if (p[4] != 1) {
        abort();
      }
    }
    */
    import "C"
    
    import (
    	"unsafe"
    )
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 644 bytes
    - Viewed (0)
  9. src/cmd/cgo/internal/testsanitizers/testdata/asan1_fail.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package main
    
    /*
    #include <stdlib.h>
    #include <stdio.h>
    
    int *p;
    int* test() {
     p = (int *)malloc(2 * sizeof(int));
     free(p);
     return p;
    }
    */
    import "C"
    import "fmt"
    
    func main() {
    	// C passes Go an invalid pointer.
    	a := C.test()
    	// Use after free
    	*a = 2 // BOOM
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 500 bytes
    - Viewed (0)
  10. src/cmd/cgo/internal/testcarchive/testdata/main4.c

    	stack_t ss;
    	int i;
    	stack_t nss;
    	struct timespec ts;
    
    	// Set up an alternate signal stack for this thread.
    	memset(&ss, 0, sizeof ss);
    	ss.ss_sp = malloc(CSIGSTKSZ);
    	if (ss.ss_sp == NULL) {
    		die("malloc");
    	}
    	ss.ss_flags = 0;
    	ss.ss_size = CSIGSTKSZ;
    	if (sigaltstack(&ss, NULL) < 0) {
    		die("sigaltstack");
    	}
    
    	// Send ourselves a SIGIO.  This will be caught by the Go
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 4.5K bytes
    - Viewed (0)
Back to top