Hi! > case 'i': > - ilist = realloc(ilist, ++ilistlen * sizeof(*ilist)); > - ilist[ilistlen - 1] = strtol(optarg, &p, 16); > + if(realloc(ilist, ++ilistlen * sizeof(*ilist)) != NULL) > + ilist[ilistlen - 1] = strtol(optarg, &p, 16);
This code is wrong. The realloc() may return _different_ address (and will copy the data if it does so). > + else{ > + fprintf(stderr, "realloc: New memory allocation > failed \n"); > + exit(1); > + } > break; > case 'l': > loops = atoi(optarg); Also the coding style does not follow LKML. -- Cyril Hrubis chru...@suse.cz ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list