Commits

Anonymous committed 72bd85a

tests: fix mismatched free() / delete[]

  • Participants
  • Parent commits 9e10fc3

Comments (1)

Files changed (10)

tests/write_image_ape/main.cc

             for(i = 0; i<data_length; i++) {
                 if(!read || data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_flac/main.cc

             for(i = 0; i<data_length; i++) {
                 if(data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_mp3/main.cc

             for(i = 0; i<data_length; i++) {
                 if(data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_mp4/main.cc

             for(i = 0; i<data_length; i++) {
                 if(!read || data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_mpc/main.cc

             for(i = 0; i<data_length; i++) {
                 if(!read || data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_ogg/main.cc

             for(i = 0; i<data_length; i++) {
                 if(data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_speex/main.cc

             for(i = 0; i<data_length; i++) {
                 if(data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_tta/main.cc

             for(i = 0; i<data_length; i++) {
                 if(data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_wav/main.cc

             for(i = 0; i<data_length; i++) {
                 if(data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;

tests/write_image_wma/main.cc

             for(i = 0; i<data_length; i++) {
                 if(!read || data[i] != read[i]) {
                     clean_up(data, data_length, fd);
-                    free(read);
+                    delete [] read;
                     return EXIT_FAILURE;
                 }
             }
             clean_up(data, data_length, fd);
-            free(read);
+            delete [] read;
             if(remove(target.c_str()) != 0 )
                 return EXIT_FAILURE;
             return EXIT_SUCCESS;