Skip to content

Commit

Permalink
Use delete[] instead of delete for array types.
Browse files Browse the repository at this point in the history
For more information, see issue 14:
https://code.google.com/p/cld2/issues/detail?id=14



git-svn-id: https://cld2.googlecode.com/svn/trunk@161 b252ecd4-b096-bf77-eb8e-91563289f87e
  • Loading branch information
[email protected] committed May 16, 2014
1 parent 3fced38 commit d076f5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions internal/cld2_dynamic_data_loader.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Copyright 2014 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -117,7 +116,7 @@ CLD2DynamicData::FileHeader* loadInternal(FILE* inFile, const void* basePointer,
if (expectedHeaderSize != bytesRead) {
std::cerr << "Header size mismatch! Expected " << expectedHeaderSize << ", but read " << bytesRead << std::endl;
delete header;
delete tableHeaders;
delete[] tableHeaders;
return NULL;
}

Expand All @@ -134,7 +133,7 @@ CLD2DynamicData::FileHeader* loadInternal(FILE* inFile, const void* basePointer,
if (actualSize != header->totalFileSizeBytes) {
std::cerr << "File size mismatch! Expected " << header->totalFileSizeBytes << ", but found " << actualSize << std::endl;
delete header;
delete tableHeaders;
delete[] tableHeaders;
return NULL;
}
return header;
Expand Down Expand Up @@ -253,7 +252,7 @@ CLD2::ScoringTables* loadDataInternal(CLD2DynamicData::FileHeader* header, const
result->deltaocta_obj = &tableSummaries[5];
result->distinctocta_obj = &tableSummaries[6];
result->kExpectedScore = read_kAvgDeltaOctaScore;
delete header->tableHeaders;
delete[] header->tableHeaders;
delete header;
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cld2_dynamic_data_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Usage:\n\
return -1;
}
CLD2DynamicData::dumpHeader(header);
delete header->tableHeaders;
delete[] header->tableHeaders;
delete header;
}

Expand Down

0 comments on commit d076f5e

Please sign in to comment.