mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-19 09:09:18 +03:00
monkey/browser.c: Handle failed calloc more gracefully
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
parent
a325d6b474
commit
6c951f7a15
@ -594,6 +594,10 @@ monkey_window_handle_exec(int argc, char **argv)
|
|||||||
total += strlen(argv[i]) + 1;
|
total += strlen(argv[i]) + 1;
|
||||||
}
|
}
|
||||||
char *cmd = calloc(total, 1);
|
char *cmd = calloc(total, 1);
|
||||||
|
if (cmd == NULL) {
|
||||||
|
moutf(MOUT_ERROR, "JS WIN %d RET ENOMEM", atoi(argv[2]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
strcpy(cmd, argv[4]);
|
strcpy(cmd, argv[4]);
|
||||||
for (int i = 5; i < argc; ++i) {
|
for (int i = 5; i < argc; ++i) {
|
||||||
strcat(cmd, " ");
|
strcat(cmd, " ");
|
||||||
|
Loading…
Reference in New Issue
Block a user