Skip to content

Commit

Permalink
🐛 Use delete [] for new []
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Aug 10, 2021
1 parent 0c0f84b commit eafd0ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Marlin/src/sd/cardreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ void CardReader::cdroot() {
#if ENABLED(SDSORT_USES_RAM) && DISABLED(SDSORT_CACHE_NAMES)
#if ENABLED(SDSORT_DYNAMIC_RAM)
for (uint16_t i = 0; i < fileCnt; ++i) free(sortnames[i]);
TERN_(HAS_FOLDER_SORTING, free(isDir));
TERN_(HAS_FOLDER_SORTING, delete [] isDir);
#endif
#endif
}
Expand All @@ -1245,14 +1245,14 @@ void CardReader::cdroot() {
void CardReader::flush_presort() {
if (sort_count > 0) {
#if ENABLED(SDSORT_DYNAMIC_RAM)
delete sort_order;
delete [] sort_order;
#if ENABLED(SDSORT_CACHE_NAMES)
LOOP_L_N(i, sort_count) {
free(sortshort[i]); // strdup
free(sortnames[i]); // strdup
}
delete sortshort;
delete sortnames;
delete [] sortshort;
delete [] sortnames;
#endif
#endif
sort_count = 0;
Expand Down

0 comments on commit eafd0ed

Please sign in to comment.