diff options
-rw-r--r-- | pugl/detail/implementation.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 6bb019d..d17d14c 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -76,10 +76,12 @@ puglStrerror(const PuglStatus status) void puglSetString(char** dest, const char* string) { - const size_t len = strlen(string); + if (*dest != string) { + const size_t len = strlen(string); - *dest = (char*)realloc(*dest, len + 1); - strncpy(*dest, string, len + 1); + *dest = (char*)realloc(*dest, len + 1); + strncpy(*dest, string, len + 1); + } } void |