summaryrefslogtreecommitdiffstats
path: root/UsersTable.c
diff options
context:
space:
mode:
authorHisham <hisham@gobolinux.org>2016-02-02 15:53:02 +0100
committerHisham <hisham@gobolinux.org>2016-02-02 15:53:02 +0100
commitb54d2dde407921caa7561dde6b45831ba93d0840 (patch)
treecd81eea35dd65e46d22f2801ea403e1efc06eb59 /UsersTable.c
parenta1f7f2869ec2bd860d5b4e4b39736ca877afdf6f (diff)
Check for failure in allocations.
Diffstat (limited to 'UsersTable.c')
-rw-r--r--UsersTable.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/UsersTable.c b/UsersTable.c
index ecabb0ad..f383256a 100644
--- a/UsersTable.c
+++ b/UsersTable.c
@@ -6,6 +6,7 @@ in the source distribution for its full text.
*/
#include "UsersTable.h"
+#include "XAlloc.h"
#include "config.h"
@@ -27,7 +28,7 @@ typedef struct UsersTable_ {
UsersTable* UsersTable_new() {
UsersTable* this;
- this = malloc(sizeof(UsersTable));
+ this = xMalloc(sizeof(UsersTable));
this->users = Hashtable_new(20, true);
return this;
}
@@ -42,7 +43,7 @@ char* UsersTable_getRef(UsersTable* this, unsigned int uid) {
if (name == NULL) {
struct passwd* userData = getpwuid(uid);
if (userData != NULL) {
- name = strdup(userData->pw_name);
+ name = xStrdup(userData->pw_name);
Hashtable_put(this->users, uid, name);
}
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy