From ca39a3cef934d0be38a311e8eb61b4641e0f54d1 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 13 Nov 2020 19:30:57 +0900 Subject: [PATCH 1/2] bpf: do not call log_oom() in library function --- src/shared/bpf-program.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/shared/bpf-program.c b/src/shared/bpf-program.c index 32881477d5..067f26d2f0 100644 --- a/src/shared/bpf-program.c +++ b/src/shared/bpf-program.c @@ -8,7 +8,6 @@ #include "alloc-util.h" #include "bpf-program.h" #include "fd-util.h" -#include "log.h" #include "memory-util.h" #include "missing_syscall.h" #include "path-util.h" @@ -18,7 +17,7 @@ int bpf_program_new(uint32_t prog_type, BPFProgram **ret) { p = new0(BPFProgram, 1); if (!p) - return log_oom(); + return -ENOMEM; p->n_ref = 1; p->prog_type = prog_type; From c4cce95731ae6ee28aee6192f16e37f9299b57b5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 13 Nov 2020 19:35:01 +0900 Subject: [PATCH 2/2] io-util: do not call log_oom() in library functions --- src/basic/io-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/io-util.c b/src/basic/io-util.c index 247e37fd80..4d7405296b 100644 --- a/src/basic/io-util.c +++ b/src/basic/io-util.c @@ -291,7 +291,7 @@ int iovw_put(struct iovec_wrapper *iovw, void *data, size_t len) { return -E2BIG; if (!GREEDY_REALLOC(iovw->iovec, iovw->size_bytes, iovw->count + 1)) - return log_oom(); + return -ENOMEM; iovw->iovec[iovw->count++] = IOVEC_MAKE(data, len); return 0; @@ -303,7 +303,7 @@ int iovw_put_string_field(struct iovec_wrapper *iovw, const char *field, const c x = strjoin(field, value); if (!x) - return log_oom(); + return -ENOMEM; r = iovw_put(iovw, x, strlen(x)); if (r >= 0)