mmdbresolve: check the return value of malloc

The return value of malloc() is used without validation

Bug: 15851
Change-Id: I2635937d3107a75076e9bbee536797d97792683d
Reviewed-on: https://code.wireshark.org/review/33705
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
XuNiu 2019-06-23 12:15:18 +08:00 committed by Anders Broman
parent 94f497f929
commit 94d0e081c6
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,10 @@ main(int argc, char *argv[])
int mmdb_err;
char *out_buf = (char *) malloc(OUT_BUF_SIZE);
if (out_buf == NULL) {
fprintf(stdout, "ERROR: malloc failed\n");
return 1;
}
setvbuf(stdout, out_buf, _IOFBF, OUT_BUF_SIZE);
fprintf(stdout, "[init]\n");