debugfs: handle out of memory condition

If malloc fails, properly handle the error condition.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
test-maint
Tobias Stoeckmann 2015-07-20 10:52:28 -04:00 committed by Theodore Ts'o
parent 9bcfea2a89
commit 9f8d9a2c5f
1 changed files with 5 additions and 0 deletions

View File

@ -97,6 +97,11 @@ void do_extent_open(int argc, char *argv[])
orig_prompt = ss_get_prompt(sci_idx);
extent_prompt = malloc(strlen(orig_prompt) + 32);
if (extent_prompt == NULL) {
com_err(argv[1], retval, "out of memory");
return;
}
strcpy(extent_prompt, orig_prompt);
cp = strchr(extent_prompt, ':');
if (cp)