Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 417 for Malloc (0.33 sec)

  1. 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)
  2. src/cmd/cgo/internal/test/issue23555b/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)
  3. 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)
  4. src/internal/msan/nomsan.go

    //go:build !msan
    
    package msan
    
    import (
    	"unsafe"
    )
    
    const Enabled = false
    
    func Read(addr unsafe.Pointer, sz uintptr) {
    }
    
    func Write(addr unsafe.Pointer, sz uintptr) {
    }
    
    func Malloc(addr unsafe.Pointer, sz uintptr) {
    }
    
    func Free(addr unsafe.Pointer, sz uintptr) {
    }
    
    func Move(dst, src unsafe.Pointer, sz uintptr) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 20 20:50:21 UTC 2024
    - 483 bytes
    - Viewed (0)
  5. 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)
  6. test/fixedbugs/issue34968.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>
    import "C"
    
    func main() {
    	C.malloc(100)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:25 UTC 2023
    - 289 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_cmsan.go

    package main
    
    /*
    #cgo LDFLAGS: -fsanitize=memory
    #cgo CPPFLAGS: -fsanitize=memory
    
    #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
    - 710 bytes
    - Viewed (0)
  9. 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)
  10. src/cmd/cgo/internal/testsanitizers/testdata/msan7.go

    typedef struct { char b; uintptr_t x, y; } T;
    
    extern void F(T);
    
    // Use weak as a hack to permit defining a function even though we use export.
    void CF(int x) __attribute__ ((weak));
    void CF(int x) {
    	T *t = malloc(sizeof(T));
    	t->b = (char)x;
    	t->x = x;
    	t->y = x;
    	F(*t);
    }
    */
    import "C"
    
    //export F
    func F(t C.T) { println(t.b, t.x, t.y) }
    
    func main() {
    	C.CF(C.int(0))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 12 11:59:56 UTC 2023
    - 834 bytes
    - Viewed (0)
Back to top