Lastly note the definition of safe_strdup():
char *safe_strdup (const char *s)
{
char *p;
size_t l;
if (!s || !*s)
return 0;
l = strlen (s) + 1;
p = (char *)safe_malloc (l);
memcpy (p, s, l);
return (p);
}
In particular, note that this returns NULL when (!*s). However
strdup() will actually return a perfectly valid string in this case: a
malloc'd single-character string containing '\0' (i.e. ""). Which is
useful, unless you KNOW that is a bug in your program.
If it's intended that it is a bug, then the line should be changed to:
if (!s || !*s){
mutt_error("safe_strdup passed NULL or a NULL string");
abort();
}
Otherwise, just check s (but still abort).
--
Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address. Replying to it will result in
undeliverable mail due to spam prevention. Sorry for the inconvenience.
pgpw3lQdWPEm3.pgp
Description: PGP signature
