[PATCH] tgtadm: handle memory allocation failure properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux