[CRIU] [PATCH] crtools: Make sure the option has been strdup'ed
Cyrill Gorcunov
gorcunov at openvz.org
Wed Oct 9 02:28:56 PDT 2013
At this moment (parsing of options on startup) we're
hardly if ever get problem with strdup. Still to be
consistent with the rest of the program code do
- use xstrdup, to print error message if we failed
- emergency exit from program on error
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
crtools.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/crtools.c b/crtools.c
index c2c3981..d99bc0c 100644
--- a/crtools.c
+++ b/crtools.c
@@ -162,7 +162,9 @@ int main(int argc, char *argv[])
}
break;
case 'o':
- opts.output = strdup(optarg);
+ opts.output = xstrdup(optarg);
+ if (!opts.output)
+ return -1;
if (log_init(optarg))
return -1;
log_inited = 1;
--
1.8.3.1
More information about the CRIU
mailing list