summaryrefslogtreecommitdiff
path: root/src/string_functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_functions.c')
-rw-r--r--src/string_functions.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/string_functions.c b/src/string_functions.c
index 471d3eb..58ee17e 100644
--- a/src/string_functions.c
+++ b/src/string_functions.c
@@ -45,6 +45,10 @@ string_cp(char** dest, char* src)
/* 1. releasing memory allocated by *dest */
if (dest != NULL) {
if ((*dest) != NULL) {
+ /* if *dest points to the same memory as src - we shouldn't do anything */
+ if ((*dest) == src) {
+ return (*dest);
+ }
free((*dest));
(*dest) = NULL;
}