diff options
| author | Andreas Schwab | 2022-10-02 12:15:27 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2022-10-02 12:20:09 +0200 |
| commit | e5a49f44ffa66bcfa4b56b5fab088f7437b0ba9d (patch) | |
| tree | 89e86fc4b17e16568b89bc95a3d033138b7cb51c /src | |
| parent | 7ff520762468b5de4684e4a3d8f0103c8f3bec64 (diff) | |
| download | emacs-e5a49f44ffa66bcfa4b56b5fab088f7437b0ba9d.tar.gz emacs-e5a49f44ffa66bcfa4b56b5fab088f7437b0ba9d.zip | |
* src/emacs.c (load_pdump): Fix use of xpalloc.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/emacs.c b/src/emacs.c index 602fa802e0b..92779a8d0de 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -867,9 +867,8 @@ load_pdump (int argc, char **argv) | |||
| 867 | } | 867 | } |
| 868 | 868 | ||
| 869 | /* Where's our executable? */ | 869 | /* Where's our executable? */ |
| 870 | ptrdiff_t bufsize, exec_bufsize; | 870 | ptrdiff_t exec_bufsize, needed; |
| 871 | emacs_executable = load_pdump_find_executable (argv[0], &bufsize); | 871 | emacs_executable = load_pdump_find_executable (argv[0], &exec_bufsize); |
| 872 | exec_bufsize = bufsize; | ||
| 873 | 872 | ||
| 874 | /* If we couldn't find our executable, go straight to looking for | 873 | /* If we couldn't find our executable, go straight to looking for |
| 875 | the dump in the hardcoded location. */ | 874 | the dump in the hardcoded location. */ |
| @@ -902,8 +901,8 @@ load_pdump (int argc, char **argv) | |||
| 902 | strip_suffix_length)) | 901 | strip_suffix_length)) |
| 903 | exenamelen = prefix_length; | 902 | exenamelen = prefix_length; |
| 904 | } | 903 | } |
| 905 | ptrdiff_t needed = exenamelen + strlen (suffix) + 1; | 904 | ptrdiff_t bufsize = exenamelen + strlen (suffix) + 1; |
| 906 | dump_file = xpalloc (NULL, &bufsize, max (1, needed - bufsize), -1, 1); | 905 | dump_file = xpalloc (NULL, &bufsize, 1, -1, 1); |
| 907 | memcpy (dump_file, emacs_executable, exenamelen); | 906 | memcpy (dump_file, emacs_executable, exenamelen); |
| 908 | strcpy (dump_file + exenamelen, suffix); | 907 | strcpy (dump_file + exenamelen, suffix); |
| 909 | result = pdumper_load (dump_file, emacs_executable); | 908 | result = pdumper_load (dump_file, emacs_executable); |