* [PATCH] notmuch-config: talloc_strdup MAILDIR and NAME environment variables
@ 2014-08-07 15:19 Tomi Ollila
2014-08-07 18:24 ` Austin Clements
2014-08-08 0:14 ` David Bremner
0 siblings, 2 replies; 3+ messages in thread
From: Tomi Ollila @ 2014-08-07 15:19 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
When defined -- the pointer is soon given to talloc_free() which
expects it to be allocated by talloc.
---
notmuch-config.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/notmuch-config.c b/notmuch-config.c
index 88831e2..db487db 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -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);
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] notmuch-config: talloc_strdup MAILDIR and NAME environment variables
2014-08-07 15:19 [PATCH] notmuch-config: talloc_strdup MAILDIR and NAME environment variables Tomi Ollila
@ 2014-08-07 18:24 ` Austin Clements
2014-08-08 0:14 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: Austin Clements @ 2014-08-07 18:24 UTC (permalink / raw)
To: Tomi Ollila; +Cc: notmuch
LGTM.
Quoth Tomi Ollila on Aug 07 at 6:19 pm:
> When defined -- the pointer is soon given to talloc_free() which
> expects it to be allocated by talloc.
> ---
> notmuch-config.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/notmuch-config.c b/notmuch-config.c
> index 88831e2..db487db 100644
> --- a/notmuch-config.c
> +++ b/notmuch-config.c
> @@ -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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] notmuch-config: talloc_strdup MAILDIR and NAME environment variables
2014-08-07 15:19 [PATCH] notmuch-config: talloc_strdup MAILDIR and NAME environment variables Tomi Ollila
2014-08-07 18:24 ` Austin Clements
@ 2014-08-08 0:14 ` David Bremner
1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2014-08-08 0:14 UTC (permalink / raw)
To: Tomi Ollila, notmuch; +Cc: tomi.ollila
Tomi Ollila <tomi.ollila@iki.fi> writes:
> When defined -- the pointer is soon given to talloc_free() which
> expects it to be allocated by talloc.
pushed.
d
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-08 0:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-07 15:19 [PATCH] notmuch-config: talloc_strdup MAILDIR and NAME environment variables Tomi Ollila
2014-08-07 18:24 ` Austin Clements
2014-08-08 0:14 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).