From bf75cf72253e28fec7e8ff7430f8fd51e4ff0b26 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 22 Mar 2002 15:02:50 +0000 Subject: [PATCH] Removed an unnecessary string allocation during copying. --- simgear/misc/props.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/simgear/misc/props.cxx b/simgear/misc/props.cxx index fc0e549a..9aeb2385 100644 --- a/simgear/misc/props.cxx +++ b/simgear/misc/props.cxx @@ -221,9 +221,8 @@ copy_string (const char * s) // FIXME: potential buffer overflow. // For some reason, strnlen and // strncpy cause all kinds of crashes. - string str = s; - char * copy = new char[str.size() + 1]; - strcpy(copy, str.c_str()); + char * copy = new char[strlen(s) + 1]; + strcpy(copy, s); return copy; } -- 2.39.2