LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] uml: Handle failed malloc.
@ 2008-02-05 16:23 Jim Meyering
  0 siblings, 0 replies; only message in thread
From: Jim Meyering @ 2008-02-05 16:23 UTC (permalink / raw)
  To: Jeff Dike, linux-kernel


* arch/um/os-Linux/mem.c (make_tempfile): Don't deref NULL upon failed malloc.

Signed-off-by: Jim Meyering <meyering@redhat.com>
---
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 436f8d2..e114d09 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -172,6 +172,8 @@ int __init make_tempfile(const char *template, char **out_tempname,

 	which_tmpdir();
 	tempname = malloc(MAXPATHLEN);
+	if (tempname == NULL)
+	  return -1;

 	find_tempdir();
 	if (template[0] != '/')

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-02-05 16:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-05 16:23 [PATCH] uml: Handle failed malloc Jim Meyering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).