ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
65878a
From 472b443a7e1949f6d35d5216b6323424719d1b8c Mon Sep 17 00:00:00 2001
65878a
From: Djalal Harouni <tixxdz@opendz.org>
65878a
Date: Tue, 5 Nov 2013 15:26:37 +0100
65878a
Subject: [PATCH] nspawn: log out of memory errors
65878a
65878a
---
65878a
 src/nspawn/nspawn.c | 7 +++++--
65878a
 1 file changed, 5 insertions(+), 2 deletions(-)
65878a
65878a
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
65878a
index 9616dbf..db47fbd 100644
65878a
--- a/src/nspawn/nspawn.c
65878a
+++ b/src/nspawn/nspawn.c
65878a
@@ -224,6 +224,9 @@ static int parse_argv(int argc, char *argv[]) {
65878a
 
65878a
                 case 'S':
65878a
                         arg_slice = strdup(optarg);
65878a
+                        if (!arg_slice)
65878a
+                                return log_oom();
65878a
+
65878a
                         break;
65878a
 
65878a
                 case 'M':
65878a
@@ -315,11 +318,11 @@ static int parse_argv(int argc, char *argv[]) {
65878a
 
65878a
                         r = strv_extend(x, a);
65878a
                         if (r < 0)
65878a
-                                return r;
65878a
+                                return log_oom();
65878a
 
65878a
                         r = strv_extend(x, b);
65878a
                         if (r < 0)
65878a
-                                return r;
65878a
+                                return log_oom();
65878a
 
65878a
                         break;
65878a
                 }