From c35a847ec5e47fa5cf03359a2c0da27fe5f1eb0f Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Fri, 5 Nov 1993 20:31:48 +0000 Subject: [PATCH] (objc_read_string): Allocate string properly. From-SVN: r6013 --- gcc/objc/archive.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/objc/archive.c b/gcc/objc/archive.c index 87bd5855fa3..1e776c71598 100644 --- a/gcc/objc/archive.c +++ b/gcc/objc/archive.c @@ -617,8 +617,11 @@ objc_read_string (struct objc_typed_stream* stream, case _B_UCOMM: { - len = __objc_read_nbyte_uint(stream, (buf[0] & _B_VALUE), &key); - (*string) = hash_value_for_key (stream->stream_table, (void*)key); + char *tmp; + len = __objc_read_nbyte_uint (stream, (buf[0] & _B_VALUE), &key); + tmp = hash_value_for_key (stream->stream_table, (void*)key); + *string = __objc_xmalloc (strlen (tmp) + 1); + strcpy (*string, tmp); } break; -- 2.30.2