diff --git a/policycoreutils/restorecond/user.c b/policycoreutils/restorecond/user.c index c315b993..ade3fb81 100644 --- a/policycoreutils/restorecond/user.c +++ b/policycoreutils/restorecond/user.c @@ -190,7 +190,11 @@ int start() { static int local_server() { // ! dbus, run as local service char *ptr=NULL; - asprintf(&ptr, "%s/.restorecond", homedir); + if (asprintf(&ptr, "%s/.restorecond", homedir) < 0) { + if (debug_mode) + perror("asprintf"); + return -1; + } int fd = open(ptr, O_CREAT | O_WRONLY | O_NOFOLLOW, S_IRUSR | S_IWUSR); if (debug_mode) g_warning ("Lock file: %s", ptr); diff --git a/policycoreutils/restorecond/watch.c b/policycoreutils/restorecond/watch.c index d9e321ec..6a833c30 100644 --- a/policycoreutils/restorecond/watch.c +++ b/policycoreutils/restorecond/watch.c @@ -226,7 +226,9 @@ static void process_config(int fd, FILE * cfg) if (buffer[0] == '~') { if (run_as_user) { char *ptr=NULL; - asprintf(&ptr, "%s%s", homedir, &buffer[1]); + if (asprintf(&ptr, "%s%s", homedir, &buffer[1]) < 0) + exitApp("Error allocating memory."); + watch_list_add(fd, ptr); free(ptr); } else {