void c4_StringArray::SetAt(int nIndex, const char* newElement) { char* s = (char*) _ptrs.GetAt(nIndex); if (s && *s) free(s);

  _ptrs.SetAt(nIndex, newElement && *newElement? _strdup(newElement) : "");
}

Hi, to me the if (s && *s) looks suspicious: Imagine you have an empty string: char *p = ""; If you were to say char *q = strdup( p); I am rather certain, that *q == '\0'

If this is true, the condition above will fail for any such string, 'free' wouldn't get called and you'd have a small leak.

HTH
Helmut Giese

_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to