summaryrefslogtreecommitdiff
path: root/src/non_critical/_tools.c
diff options
context:
space:
mode:
authornamilsk <namilsk@namilsk.tech>2026-02-11 14:44:05 +0300
committernamilsk <namilsk@namilsk.tech>2026-02-11 14:44:05 +0300
commitfe3e68bab9cfbb3339eca90ebf7b0a3157e0e457 (patch)
treee733d09c54d0adb90092468036b642e3359ea42e /src/non_critical/_tools.c
parent31d8e9b3cb37b4a8e014b3581ce67267e68217f2 (diff)
Fixed warnings
Diffstat (limited to 'src/non_critical/_tools.c')
-rw-r--r--src/non_critical/_tools.c10
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;
}
}