]> Cypherpunks repositories - gostls13.git/commitdiff
gob: when decoding a string, allocate a string, not a []byte.
authorIan Lance Taylor <iant@golang.org>
Fri, 15 Apr 2011 13:49:39 +0000 (06:49 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 15 Apr 2011 13:49:39 +0000 (06:49 -0700)
R=r, r2
CC=golang-dev
https://golang.org/cl/4430042

src/pkg/gob/decode.go

index 4da7b5c3796761274ceaa9b1aa6f46d6cf8a2cec..aebe75e345dac4310dd726241d1fb7c92e2a6792 100644 (file)
@@ -406,7 +406,7 @@ func decUint8Array(i *decInstr, state *decoderState, p unsafe.Pointer) {
 func decString(i *decInstr, state *decoderState, p unsafe.Pointer) {
        if i.indir > 0 {
                if *(*unsafe.Pointer)(p) == nil {
-                       *(*unsafe.Pointer)(p) = unsafe.Pointer(new([]byte))
+                       *(*unsafe.Pointer)(p) = unsafe.Pointer(new(string))
                }
                p = *(*unsafe.Pointer)(p)
        }