Hi jkl, > > ret = (char *)calloc(strlen(charset) + 1, 1); > > strcpy(ret, charset); > > As a logical matter, the calloc call should have the count as the first > argument: > > ret = (char *)calloc(1, strlen(charset) + 1);
True, or just malloc(), as I think I pointed out, since all the zeroed bytes are trampled by the strcpy(). And why not strdup(3), though not knowing C++, having deliberately avoided it, perhaps that's not usual? But this kind of thing is best accompanied by a scan of all the source looking for patterns of things that can be cleaned up, and keeping those ad-hoc searches to hand for regressions. -- Cheers, Ralph. https://plus.google.com/+RalphCorderoy