From fbb12e77d53ac24a74688bccf42ed17e841b19d0 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Mon, 9 Apr 2018 10:19:01 +0200 Subject: [PATCH] util.c: make "Out of memory" messages a bit more informative Since these are emitted in multiple places and are not expected during any normal operation, it makes sense to report the caller name. * util.c (print_quoted_string_ex, print_quoted_string_ex, dumpiov_upto, dumpstr): Replace error_msg with error_func_msg. --- util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util.c b/util.c index 468904d7..89856ae8 100644 --- a/util.c +++ b/util.c @@ -693,7 +693,7 @@ print_quoted_string_ex(const char *str, unsigned int size, alloc_size = 4 * size; if (alloc_size / 4 != size) { - error_msg("Out of memory"); + error_func_msg("Out of memory"); tprints("???"); return -1; } @@ -706,7 +706,7 @@ print_quoted_string_ex(const char *str, unsigned int size, } else { outstr = buf = malloc(alloc_size); if (!buf) { - error_msg("Out of memory"); + error_func_msg("Out of memory"); tprints("???"); return -1; } @@ -888,7 +888,7 @@ dumpiov_upto(struct tcb *const tcp, const int len, const kernel_ulong_t addr, /* Assuming no sane program has millions of iovs */ if ((unsigned)len > 1024*1024 /* insane or negative size? */ || (iov = malloc(size)) == NULL) { - error_msg("Out of memory"); + error_func_msg("Out of memory"); return; } if (umoven(tcp, addr, size, iov) >= 0) { @@ -935,7 +935,7 @@ dumpstr(struct tcb *const tcp, const kernel_ulong_t addr, const int len) str = malloc(len + 16); if (!str) { strsize = -1; - error_msg("Out of memory"); + error_func_msg("Out of memory"); return; } strsize = len + 16; -- 2.40.0