2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Add missing warnings for memory allocation failure.

Add function name to memory allocation warnings.
This commit is contained in:
Todd C. Miller
2015-07-14 14:50:36 -06:00
parent 3c644f5bc0
commit 108bfb7af3
3 changed files with 20 additions and 12 deletions

View File

@@ -53,7 +53,7 @@ fill_txt(const char *src, int len, int olen)
dst = olen ? realloc(sudoerslval.string, olen + len + 1) : malloc(len + 1);
if (dst == NULL) {
sudo_warn(NULL);
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
sudoerserror(NULL);
debug_return_bool(false);
}
@@ -106,7 +106,7 @@ fill_cmnd(const char *src, int len)
dst = sudoerslval.command.cmnd = malloc(len + 1);
if (sudoerslval.command.cmnd == NULL) {
sudo_warn(NULL);
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
sudoerserror(NULL);
debug_return_bool(false);
}
@@ -144,9 +144,9 @@ fill_args(const char *s, int len, int addspace)
p = realloc(sudoerslval.command.args, arg_size);
if (p == NULL) {
free(sudoerslval.command.args);
sudo_warn(NULL);
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
sudoerserror(NULL);
free(sudoerslval.command.args);
debug_return_bool(false);
} else
sudoerslval.command.args = p;