When defined -- the pointer is soon given to talloc_free() which
expects it to be allocated by talloc.
if (notmuch_config_get_database_path (config) == NULL) {
char *path = getenv ("MAILDIR");
if (notmuch_config_get_database_path (config) == NULL) {
char *path = getenv ("MAILDIR");
+ if (path)
+ path = talloc_strdup (config, path);
+ else
path = talloc_asprintf (config, "%s/mail",
getenv ("HOME"));
notmuch_config_set_database_path (config, path);
path = talloc_asprintf (config, "%s/mail",
getenv ("HOME"));
notmuch_config_set_database_path (config, path);
if (notmuch_config_get_user_name (config) == NULL) {
char *name = getenv ("NAME");
if (notmuch_config_get_user_name (config) == NULL) {
char *name = getenv ("NAME");
+ if (name)
+ name = talloc_strdup (config, name);
+ else
name = get_name_from_passwd_file (config);
notmuch_config_set_user_name (config, name);
talloc_free (name);
name = get_name_from_passwd_file (config);
notmuch_config_set_user_name (config, name);
talloc_free (name);