When exit() is called from ParseArgs(), no destructors are executed
for the auto variables vars_vec and vars_values.
Making both variables static fixes the memory leaks, because now the
destructors are always executed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1164526 (#1 of 1): Resource leak in object (CTOR_DTOR_LEAK)
2. alloc_fn: Calling allocation function socket.
The previous stream_ must be closed before opening a new one.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1340280 (#1 of 1): Resource leak (RESOURCE_LEAK)
7. leaked_storage: Variable FloatFeatures going out of scope leaks the storage it points to.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1340278 (#1 of 1): Resource leak (RESOURCE_LEAK)
11. leaked_storage: Variable output_file going out of scope leaks the storage it points to.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1164739 (#1 of 1): Resource leak (RESOURCE_LEAK)
18. leaked_storage: Variable frag going out of scope leaks the storage it points to.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1164738 (#1 of 1): Resource leak (RESOURCE_LEAK)
7. leaked_storage: Variable sample going out of scope leaks the storage it points to.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1164737 (#1 of 1): Resource leak (RESOURCE_LEAK)
49. leaked_storage: Variable p going out of scope leaks the storage it points to.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1164730 (#1 of 1): Resource leak (RESOURCE_LEAK)
4. leaked_storage: Variable lines going out of scope leaks the storage it points to.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Coverity report:
CID 1164728 (#1 of 1): Resource leak (RESOURCE_LEAK)
33. leaked_storage: Variable argv going out of scope leaks the storage it points to.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This fixes several gcc warnings:
warning:
type qualifiers ignored on function return type [-Wignored-qualifiers]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
In osdetect.cpp, a local definition of kMinCredibleResolution was
identical to a global one, so the local one could be removed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This fixes a compiler warning:
api/baseapi.cpp:1743:11: warning:
unused variable 'kBytesPerBlob' [-Wunused-const-variable]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This fixes a compiler warning:
classify/intfeaturemap.cpp:33:14: warning:
unused variable 'kMinPCLengthIncrease' [-Wunused-const-variable]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
It conflicts with a previous 'class' declaration for ETEXT_DESC:
include/tesseract/baseapi.h:594:21:
Struct 'ETEXT_DESC' was previously declared as a class
Signed-off-by: Stefan Weil <sw@weilnetz.de>
A haystack which is shorter than the needle resulted in negative value
for length_haystack which was forced to a very large unsigned value.
The resulting buffer overflow while reading the haystack would crash
text2image when it was called with a short font name.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Assertions are good for programming errors, but not for wrong user input.
The new code no longer needs File::ReadFileToStringOrDie, so remove that
method.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
The implementation for MS C did not pass the variable arguments to
tprintf.
The standard is supported since C99 / C++11, so one implementation
is sufficient.
Signed-off-by: Stefan Weil <sw@weilnetz.de>