On 3/10/2015 5:21 PM, David C. Rankin wrote: > All, > > I have an issue with valgrind-3.8.1 (openSuSE 13.1 x86_64) reporting the > error: > > Conditional jump or move depends on uninitialised value(s) > > The error stems from reallocation of a new block of memory. The error is > triggered when iterating over the reallocated pointer array into the > reallocated > block, despite explicitly setting/initializing values of the new pointers to 0 > with memset (equivalent to the original allocation with calloc).
Not quite. calloc() gets the size of the object being cleared in addition to the number of objects, while memset() gets only the size in bytes. You need to multiply cmax by sizeof(*slines), as you did for the realloc() call. (Of course, "slines + cmax" on the same line of code is pointer arithmetic, so it automatically performs this multiplication. C does have its warts.) -- David Chapman dcchap...@acm.org Chapman Consulting -- San Jose, CA Software Development Done Right. www.chapman-consulting-sj.com ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users