OSDN Git Service

simpleperf: fix a check error.
authorYabin Cui <yabinc@google.com>
Tue, 22 Nov 2016 23:32:03 +0000 (15:32 -0800)
committerYabin Cui <yabinc@google.com>
Tue, 22 Nov 2016 23:35:04 +0000 (15:35 -0800)
Bug: None.
Test: `simpleperf record` a sleep process.
Change-Id: I334e9fb857743c63bf0a0b4b50f1a723d47ba6e7

simpleperf/record_file_writer.cpp

index 802a66d..fe62ab5 100644 (file)
@@ -355,7 +355,8 @@ bool RecordFileWriter::WriteFeatureEnd(int feature) {
 }
 
 bool RecordFileWriter::EndWriteFeatures() {
-  CHECK_LE(feature_count_, features_.size());
+  // Used features (features_.size()) should be <= allocated feature space.
+  CHECK_LE(features_.size(), feature_count_);
   if (fseek(record_fp_, feature_section_offset_, SEEK_SET) == -1) {
     PLOG(ERROR) << "fseek() failed";
     return false;