diff options
Diffstat (limited to 'ident/ident.c')
-rw-r--r-- | ident/ident.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ident/ident.c b/ident/ident.c index dbf3f9b..75d51fa 100644 --- a/ident/ident.c +++ b/ident/ident.c @@ -1,5 +1,5 @@ /* This file is part of GNU Pies. - Copyright (C) 2015 Sergey Poznyakoff + Copyright (C) 2015-2016 Sergey Poznyakoff GNU Pies is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,10 +19,20 @@ pies_identity_t pies_identity_create (char const *user) { - pies_identity_t id = xmalloc (sizeof (*id)); - id->provider = NULL; - id->username = xstrdup (user); - id->data = NULL; + pies_identity_t id = malloc (sizeof (*id)); + if (id) + { + id->provider = NULL; + id->data = NULL; + id->username = strdup (user); + if (!id) + { + int ec = errno; + free (id); + errno = ec; + id = NULL; + } + } return id; } |