From: Tobias Stoeckmann Date: Mon, 20 Jul 2015 14:52:28 +0000 (-0400) Subject: debugfs: handle out of memory condition X-Git-Tag: v1.43-WIP-2016-03-15~56^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f8d9a2c5fb8443b41183545c682189d8743923c;p=thirdparty%2Fe2fsprogs.git debugfs: handle out of memory condition If malloc fails, properly handle the error condition. Signed-off-by: Tobias Stoeckmann Signed-off-by: Theodore Ts'o --- diff --git a/debugfs/extent_inode.c b/debugfs/extent_inode.c index 8b22f5e37..c7a92a763 100644 --- a/debugfs/extent_inode.c +++ b/debugfs/extent_inode.c @@ -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)