mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
notmuch-config: talloc_strdup MAILDIR and NAME environment variables
When defined -- the pointer is soon given to talloc_free() which expects it to be allocated by talloc.
This commit is contained in:
parent
9f0f30f7de
commit
748798511d
1 changed files with 6 additions and 2 deletions
|
@ -324,7 +324,9 @@ notmuch_config_open (void *ctx,
|
|||
|
||||
if (notmuch_config_get_database_path (config) == NULL) {
|
||||
char *path = getenv ("MAILDIR");
|
||||
if (! path)
|
||||
if (path)
|
||||
path = talloc_strdup (config, path);
|
||||
else
|
||||
path = talloc_asprintf (config, "%s/mail",
|
||||
getenv ("HOME"));
|
||||
notmuch_config_set_database_path (config, path);
|
||||
|
@ -333,7 +335,9 @@ notmuch_config_open (void *ctx,
|
|||
|
||||
if (notmuch_config_get_user_name (config) == NULL) {
|
||||
char *name = getenv ("NAME");
|
||||
if (! 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);
|
||||
|
|
Loading…
Reference in a new issue