Hi, This patch try fixes : 1. Coverity and GCC report about absence break into switch or implicit fallthrough: https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them https://en.wiktionary.org/wiki/fall-through https://github.com/Microsoft/TypeScript/issues/393
2. /* prevent resource leak: CID 210676 Coverity */ http://www.cplusplus.com/reference/cstdlib/free/ If ptr is a null pointer, the function does nothing. free call with NULL var, is nop call. Best regards, Ranier Vilela static void iAttribParse(Ihandle *ih, const char* str) { char* env_buffer[256]; const char* name=NULL; const char* value=NULL; char state = 'a'; /* get attribute */ int end = 0; env_str = str; for (;;) { switch (iAttribToken(env_buffer)) { case IUPLEX_TK_END: /* same as IUPLEX_TK_COMMA */ end = 1; /* fallthrough */ case IUPLEX_TK_COMMA: if (name) { IupStoreAttribute(ih, name, value); free(name); } if (end) return; name = value = NULL; state = 'a'; break; case IUPLEX_TK_SET: state = 'v'; /* get value */ break; case IUPLEX_TK_NAME: if (state == 'a') { free(name); /* prevent resource leak: CID 210676 Coverity */ name = iupStrDup(env_buffer); } else value = env_buffer; break; } } } ---------------------------------------------------- who talks a lot does less either.
iup_attrib.c.patch
Description: iup_attrib.c.patch
_______________________________________________ Iup-users mailing list Iup-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/iup-users