[stgt] [PATCH] tgtadm: handle memory allocation failure properly

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Fri Jun 19 07:44:37 CEST 2009


Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 usr/tgtadm.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/usr/tgtadm.c b/usr/tgtadm.c
index 8d9f7e2..0b89e85 100644
--- a/usr/tgtadm.c
+++ b/usr/tgtadm.c
@@ -439,6 +439,11 @@ int main(int argc, char **argv)
 	user = password = NULL;
 
 	buf = valloc(bufsz);
+	if (!buf) {
+		eprintf("%s\n",	tgtadm_strerror(TGTADM_NOMEM));
+		return ENOMEM;
+	}
+		
 	memset(buf, 0, bufsz);
 	req = (struct tgtadm_req *) buf;
 
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list