From d0fa2e6b7bccb00dbaae09a4d4c1a87b1dea0351 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 3 Aug 2009 08:43:54 -0400 Subject: [PATCH] guestfs: don't fault upon failed vasprintf * src/guestfs.c (guestfs_perrorf): Handle failed vasprintf. --- src/guestfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/guestfs.c b/src/guestfs.c index 63e24f0..802c1d2 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -443,9 +443,11 @@ guestfs_perrorf (guestfs_h *g, const char *fs, ...) int err = errno; va_start (args, fs); - vasprintf (&msg, fs, args); + int err = vasprintf (&msg, fs, args); va_end (args); + if (err < 0) return; + #ifndef _GNU_SOURCE char buf[256]; strerror_r (err, buf, sizeof buf); -- 1.8.3.1