[PATCH] don't ignore failing strdup
Jim Meyering
jim at meyering.net
Wed Mar 30 18:37:42 UTC 2011
Another OOM-related fix:
>From 89bed8fd8218cbb7f5c259de3c072df2c1a454f8 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Wed, 30 Mar 2011 20:26:31 +0200
Subject: [PATCH] don't ignore failing strdup
* meta.cpp (RepoMeta::GetValue): Diagnose a failing strdup
rather than claiming "success" and providing a NULL result.
---
meta.cpp | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/meta.cpp b/meta.cpp
index 110a7c6..aa533c2 100644
--- a/meta.cpp
+++ b/meta.cpp
@@ -375,6 +375,9 @@ RepoMeta::GetValue (const char *bucket, const char *key, const char *mkey,
}
*mvalue = strdup(data);
+ if (*mvalue == NULL)
+ return ENOMEM;
+
return 0;
}
--
1.7.4.2.662.gcbd0
More information about the iwhd-devel
mailing list