From 3a704ca670d12400482148da907b191cf518eab4 Mon Sep 17 00:00:00 2001 From: Laurin Date: Tue, 6 Feb 2024 14:43:07 +0100 Subject: [PATCH] refactoring: freed allocated memory of result strings in main program --- src/conversionOfNumbers/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/conversionOfNumbers/main.c b/src/conversionOfNumbers/main.c index c2679ca..b6b5151 100644 --- a/src/conversionOfNumbers/main.c +++ b/src/conversionOfNumbers/main.c @@ -1,6 +1,7 @@ #include "conversionOfNumbers.h" #include "../userinput.h" #include +#include int main(){ int min = 0; @@ -34,6 +35,7 @@ int main(){ int toConvert = usergetd("\nGeben Sie eine Ganzzahl ein: ", NULL, NULL); char* result = convertIntToBinaryStr(toConvert); printf("\nAusgabe (in Binaer): %s\n", result); + free(result); } } if(InputSys == 1){ @@ -47,6 +49,7 @@ int main(){ int toConvert = usergetd("\nGeben Sie eine positive Ganzzahl ein: ", &rangeMin, NULL); char* result = convertIntToHex(toConvert); printf("\nAusgabe (in Hex): %s\n", result); + free(result); } } }