mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 06:30:14 +08:00
Fix CID 1164579 (Explicit null dereferenced)
The report from Coverity Scan is a false positive. Nevertheless the code can be rewritten and optimized a little bit to fix that report. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
9a1f14f2aa
commit
04703ca8df
@ -661,11 +661,16 @@ class GenericVectorEqEq : public GenericVector<T> {
|
||||
template <typename T>
|
||||
void GenericVector<T>::init(int size) {
|
||||
size_used_ = 0;
|
||||
size_reserved_ = 0;
|
||||
data_ = nullptr;
|
||||
if (size <= 0) {
|
||||
data_ = nullptr;
|
||||
size_reserved_ = 0;
|
||||
} else {
|
||||
if (size < kDefaultVectorSize) size = kDefaultVectorSize;
|
||||
data_ = new T[size];
|
||||
size_reserved_ = size;
|
||||
}
|
||||
clear_cb_ = nullptr;
|
||||
compare_cb_ = nullptr;
|
||||
reserve(size);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user