if (!stat(path, &st) && S_ISDIR(st.st_mode)) {
module_folders = realloc(module_folders, sizeof(p) * (n + 2));
- if (!module_folders)
+ if (!module_folders) {
+ ULOG_ERR("out of memory\n");
return -1;
+ }
module_folders[n++] = strdup(path);
}
}
data = malloc(s.st_size);
- if (!data)
+ if (!data) {
+ ULOG_ERR("out of memory\n");
goto out;
+ }
if (read(fd, data, s.st_size) == s.st_size) {
ret = syscall(__NR_init_module, data, (unsigned long) s.st_size, options);
options = malloc(len);
if (!options) {
+ ULOG_ERR("out of memory\n");
ret = -1;
goto err;
}
dir = argv[1];
path = malloc(strlen(dir) + 2);
- if (!path)
+ if (!path) {
+ ULOG_ERR("out of memory\n");
return -1;
+ }
strcpy(path, dir);
strcat(path, "*");