From db28e6c8e3dc2d148ae14b2c7bf14b63c1237cb6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Nov 2015 17:59:31 -0500 Subject: Avoid use of strdup --- pugl/pugl_internal.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pugl') diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h index 7dc9cfa..bef8399 100644 --- a/pugl/pugl_internal.h +++ b/pugl/pugl_internal.h @@ -28,6 +28,9 @@ PUGL_HAVE_GL: Include OpenGL support code. */ +#include +#include + #include "pugl/pugl.h" #include "pugl/event.h" @@ -120,8 +123,11 @@ puglInitWindowAspectRatio(PuglView* view, void puglInitWindowClass(PuglView* view, const char* name) { + const size_t len = strlen(name); + free(view->windowClass); - view->windowClass = strdup(name); + view->windowClass = (char*)calloc(1, len + 1); + memcpy(view->windowClass, name, len); } void -- cgit v1.2.1