diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c index 165ba4dc..dfb1c083 100644 --- a/libkmod/libkmod-config.c +++ b/libkmod/libkmod-config.c @@ -241,7 +241,7 @@ static int kmod_config_add_blacklist(struct kmod_config *config, const char *mod DBG(config->ctx, "modname=%s\n", modname); - p = strdup(modname); + _clang_suppress_alloc_ p = strdup(modname); if (!p) return -ENOMEM; diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c index 47c6305a..cdf90135 100644 --- a/libkmod/libkmod-module.c +++ b/libkmod/libkmod-module.c @@ -828,7 +828,7 @@ static int module_do_install_commands(struct kmod_module *mod, const char *optio size_t suffixlen = cmdlen - prefixlen - varlen; size_t slen = cmdlen - varlen + options_len; char *suffix = p + varlen; - char *s = malloc(slen + 1); + _clang_suppress_alloc_ char *s = malloc(slen + 1); if (!s) return -ENOMEM; diff --git a/shared/util.c b/shared/util.c index 6d1cf420..7a1f3ee8 100644 --- a/shared/util.c +++ b/shared/util.c @@ -419,7 +419,7 @@ int mkdir_p(const char *path, int len, mode_t mode) _cleanup_free_ char *start; char *end; - start = memdup(path, len + 1); + _clang_suppress_alloc_ start = memdup(path, len + 1); if (!start) return -ENOMEM; diff --git a/tools/depmod.c b/tools/depmod.c index a1ba388d..3bb5a519 100644 --- a/tools/depmod.c +++ b/tools/depmod.c @@ -1913,7 +1913,7 @@ static void depmod_report_cycles(struct depmod *depmod, uint16_t n_mods, uint16_ n_r++; } - stack = malloc(n_r * sizeof(void *)); + _clang_suppress_alloc_ stack = malloc(n_r * sizeof(void *)); if (stack == NULL) { ERR("No memory to report cycles\n"); goto out_list; @@ -2920,7 +2920,8 @@ static int do_depmod(int argc, char *argv[]) break; case 'C': { size_t bytes = sizeof(char *) * (n_config_paths + 2); - void *tmp = realloc(config_paths, bytes); + _clang_suppress_alloc_ void *tmp = realloc(config_paths, bytes); + if (!tmp) { fputs("Error: out-of-memory\n", stderr); goto cmdline_failed;