anitazha / rpms / systemd

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