Consistently print OOM diagnostic messages

* bjm.c (sys_query_module): Use error_msg to print OOM diagnostics.
* util.c (dumpiov, dumpstr): Likewise.
This commit is contained in:
Дмитрий Левин 2015-05-25 23:33:31 +03:00
parent 3e9d71feaa
commit df3899149e
2 changed files with 4 additions and 4 deletions

4
bjm.c
View File

@ -107,7 +107,7 @@ SYS_FUNC(query_module)
size_t idx;
if (!data) {
fprintf(stderr, "out of memory\n");
error_msg("Out of memory");
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
if (umoven(tcp, tcp->u_arg[2],
@ -134,7 +134,7 @@ SYS_FUNC(query_module)
size_t idx;
if (!data) {
fprintf(stderr, "out of memory\n");
error_msg("Out of memory");
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
if (umoven(tcp, tcp->u_arg[2],

4
util.c
View File

@ -828,7 +828,7 @@ dumpiov(struct tcb *tcp, int len, long addr)
/* Assuming no sane program has millions of iovs */
if ((unsigned)len > 1024*1024 /* insane or negative size? */
|| (iov = malloc(size)) == NULL) {
fprintf(stderr, "Out of memory\n");
error_msg("Out of memory");
return;
}
if (umoven(tcp, addr, size, iov) >= 0) {
@ -871,7 +871,7 @@ dumpstr(struct tcb *tcp, long addr, int len)
str = malloc(len + 16);
if (!str) {
strsize = -1;
fprintf(stderr, "Out of memory\n");
error_msg("Out of memory");
return;
}
strsize = len + 16;