From 0b5007df01a3f60ad5eb690c805153d6fa7760c0 Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Sun, 17 Mar 2013 09:09:41 +0000 Subject: [PATCH] strdup instead of malloc/strcpy git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1561 7f0cb862-5218-0410-a997-914c9d46530a --- src/mswin/fg_window_mswin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mswin/fg_window_mswin.c b/src/mswin/fg_window_mswin.c index 8342503..4365b8c 100644 --- a/src/mswin/fg_window_mswin.c +++ b/src/mswin/fg_window_mswin.c @@ -923,8 +923,7 @@ void fgPlatformGlutSetWindowTitle( const char* title ) /* Make copy of string to refer to later */ if (fgStructure.CurrentWindow->State.pWState.WindowTitle) free(fgStructure.CurrentWindow->State.pWState.WindowTitle); - fgStructure.CurrentWindow->State.pWState.WindowTitle = malloc (strlen(title) + 1); - strcpy(fgStructure.CurrentWindow->State.pWState.WindowTitle, title); + fgStructure.CurrentWindow->State.pWState.WindowTitle = strdup(title); } /* @@ -935,8 +934,7 @@ void fgPlatformGlutSetIconTitle( const char* title ) /* Make copy of string to refer to later */ if (fgStructure.CurrentWindow->State.pWState.IconTitle) free(fgStructure.CurrentWindow->State.pWState.IconTitle); - fgStructure.CurrentWindow->State.pWState.IconTitle = malloc (strlen(title) + 1); - strcpy(fgStructure.CurrentWindow->State.pWState.IconTitle, title); + fgStructure.CurrentWindow->State.pWState.IconTitle = strdup(title); } /* -- 1.7.10.4