Parcourir la source

fix: free the malloced memory after usage

RaZe il y a 3 ans
Parent
commit
4abc565b77
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  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();
         }