diff options
Diffstat (limited to 'src/non_critical/_tools.c')
| -rw-r--r-- | src/non_critical/_tools.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/non_critical/_tools.c b/src/non_critical/_tools.c index 4b6159d..967c820 100644 --- a/src/non_critical/_tools.c +++ b/src/non_critical/_tools.c @@ -35,7 +35,15 @@ char* get_os_name() { if (end != NULL) { *end = '\0'; } - return name; + + // Allocate memory for the result and copy the string + char* result = malloc(strlen(name) + 1); + if (result != NULL) { + strcpy(result, name); + } + + fclose(file); + return result; } } |
