Use xstrdup() instead of strdup(), xmalloc() instead of malloc().