Hi, I agree wtih "set freed stack-based pointers to NULL". Its aways a good idea set var pointer to NULL after released by free function.
Best. Ranier ________________________________________ De: sur-behoffski <[email protected]> Enviado: terça-feira, 12 de dezembro de 2017 22:44 Para: IUP discussion list. Assunto: [Iup-users] Thanks for the work so far; proposed IM patch for SVN-r737 G'day again, Thank you for your responses to the three build summaries I sent out yesterday. I've updated my Subversion repositories. Attached is a patch for im/trunk/src/process/im_analyze.cpp, which gets rid of some of the remaining "misleading indentation" warnings. The comments in the patch, as well as the paranoid "set freed stack-based pointers to NULL", are somewhat jarring relative to the general tone and flow of the overall code of the module. I would expect that some, or perhaps most, of these comments and paranoid code would not be included in the immediate future; however, they may be considered at some point. I'm using some level of paranoia in my personal code, because I am striving to stay very clean in using and freeing memory slabs and all associated memory pointers, so that it is clean when run under Valgrind. Although I've tackled a significant slab of code, there are more opportunities for this kind of rewrite in a few places, perhaps mostly further down in the same function; e.g. (line numbers are rough figures since they assume the attached patch has been applied): - Lines 834-844; - Lines 963-974; And a couple of places where we can rely on free(3) to quietly ignore NULL pointers: - Lines 707-708 ("if (local_data_cx) free(local_data_cx);"); - Line 1113 ("if (holes_perim) free(holes_perim);"). cheers, sur-behoffski programmer, Grouse Software ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Iup-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/iup-users
