Explorar o código

fix: free the malloced memory after usage

RaZe %!s(int64=3) %!d(string=hai) anos
pai
achega
4abc565b77
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  1. 3 1
      rubiks_cube_scrambler.c

+ 3 - 1
rubiks_cube_scrambler.c

@@ -49,7 +49,9 @@ static void draw_callback(Canvas* canvas, void* ctx) {
         genScramble ();
         scrambleReplace();
         valid();
-        strcpy(scramble, printData());
+        char *data = printData();
+        strcpy(scramble, data);
+        free(data);
         if (notifications_enabled) {
             success_vibration();
         }