On 03/10/2015 08:07 PM, David Chapman wrote: > 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.) >
Hah!, Thank you David! (smacks self, places pointed circular hat on head, and turns sadly to face the corner ;-) Sheeze, I can't believe I walked right into that one! Thanks for solving a 'forest for the trees issue.' I could have looked at that for 2-days and never snapped to the omission. Thanks -- David C. Rankin, J.D.,P.E. ------------------------------------------------------------------------------ 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