Valgrind shows "Conditional jump or move depends on uninitialised value(s)" (Bug #1535)
Description
In this short example,
#include <opencv2/opencv.hpp> int main(int argc, char** argv) { cv::Mat img = cv::imread("img.png"); return 0; }
valgrind is showing following output.
==7028== Memcheck, a memory error detector ==7028== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==7028== Using Valgrind-3.6.1-Debian and [[LibVEX]]; rerun with -h for copyright info ==7028== Command: ./a.out ==7028== ==7028== Conditional jump or move depends on uninitialised value(s) ==7028== at 0x620B510: inflateReset2 (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4) ==7028== by 0x620B605: inflateInit2_ (in /lib/x86_64-linux-gnu/libz.so.1.2.3.4) ==7028== by 0x6B140A3: png_create_read_struct_2 (in /lib/x86_64-linux-gnu/libpng12.so.0.46.0) ==7028== by 0x6B14266: png_create_read_struct (in /lib/x86_64-linux-gnu/libpng12.so.0.46.0) ==7028== by 0x525A1DF: cv::PngDecoder::readHeader() (in /usr/local/lib/libopencv_highgui.so.2.3.1) ==7028== by 0x52428A4: cv::imread_(std::string const&, int, int, cv::Mat*) (in /usr/local/lib/libopencv_highgui.so.2.3.1) ==7028== by 0x5243184: cv::imread(std::string const&, int) (in /usr/local/lib/libopencv_highgui.so.2.3.1) ==7028== by 0x400BB5: main (main.cpp:5) ==7028== ==7028== ==7028== HEAP SUMMARY: ==7028== in use at exit: 8,288 bytes in 4 blocks ==7028== total heap usage: 103 allocs, 99 frees, 129,690 bytes allocated ==7028== ==7028== LEAK SUMMARY: ==7028== definitely lost: 0 bytes in 0 blocks ==7028== indirectly lost: 0 bytes in 0 blocks ==7028== possibly lost: 0 bytes in 0 blocks ==7028== still reachable: 8,288 bytes in 4 blocks ==7028== suppressed: 0 bytes in 0 blocks ==7028== Rerun with --leak-check=full to see details of leaked memory ==7028== ==7028== For counts of detected and suppressed errors, rerun with: -v ==7028== Use --track-origins=yes to see where uninitialised values come from ==7028== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)
The code was compiled with this command:
g++ -g main.cpp @pkg-config --cflags --libs opencv@
I believe, it is a bug or am I missing something?
Associated revisions
Merge pull request #1535 from asmorkalov:android_ndk_r9
History
Updated by Luis Díaz Más about 13 years ago
As you can see in the trace of valgrind, the problem is not due to OpenCV, but to libz. If this kind of warnings annoy you, you can create a file with the messages you want to avoid and specify the option --suppressions=<filename> in the program. Take a look to the valgrind documentation to see the syntax of this file ;)
- Status changed from Open to Done
- (deleted custom field) set to invalid
Updated by Andrey Kamaev about 13 years ago
- Status changed from Done to Cancelled
Updated by Andrey Kamaev almost 13 years ago
- Target version set to 2.4.0