[Metakit] Re: Win CE problem
hgiese at ratiosoft.com
Wed Feb 11 13:04:01 CET 2004
>void c4_StringArray::SetAt(int nIndex, const char* newElement)
> char* s = (char*) _ptrs.GetAt(nIndex);
> if (s && *s)
> _ptrs.SetAt(nIndex, newElement && *newElement? _strdup(newElement) : "");
to me the
if (s && *s)
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.
More information about the Metakit