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:
parent
94f497f929
commit
94d0e081c6
|
@ -68,6 +68,10 @@ main(int argc, char *argv[])
|
||||||
int mmdb_err;
|
int mmdb_err;
|
||||||
|
|
||||||
char *out_buf = (char *) malloc(OUT_BUF_SIZE);
|
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);
|
setvbuf(stdout, out_buf, _IOFBF, OUT_BUF_SIZE);
|
||||||
|
|
||||||
fprintf(stdout, "[init]\n");
|
fprintf(stdout, "[init]\n");
|
||||||
|
|
Loading…
Reference in New Issue