commit 993563078f7c1776557325faab8b39e4afe37bed
Author: Jim Meyering <meyering(a)redhat.com>
Date: Thu Apr 7 15:30:58 2011 +0200
dc-rhev-image: always diagnose OOM
* dc-rhev-image.c: Include "xalloc.h".
(ensure_path): Use xstrdup, not strdup, so as to exit upon failure.
dc-rhev-image.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/dc-rhev-image.c b/dc-rhev-image.c
index 872ce3b..b9c3479 100644
--- a/dc-rhev-image.c
+++ b/dc-rhev-image.c
@@ -49,6 +49,7 @@
#include "copy-file.h"
#include "progname.h"
#include "dirname.h"
+#include "xalloc.h"
/*
* Note that we almost never prefix with TAG due to compatibility with EC2.
@@ -269,12 +270,8 @@ cfg_veripick(char **cfgval, const char *cfgname, json_t *jcfg,
static void ensure_path(const char *filename)
{
- char *path;
char *s;
-
- path = strdup(filename);
- if (!path)
- return;
+ char *path = xstrdup(filename);
for (s = path; ; s++) {
if (!*s)
break;
Show replies by date