[augeas-devel] augeas: master - * src/lens.c (ambig_check): report OOM from fa_ambig_example

David Lutterkort lutter at fedoraproject.org
Thu Jan 14 22:58:14 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=d640667168c83297dde3f361ab8cd33945f1b124
Commit:        d640667168c83297dde3f361ab8cd33945f1b124
Parent:        e370e1afa8a7f66a1819f06d941c57daa68cce59
Author:        David Lutterkort <lutter at redhat.com>
AuthorDate:    Thu Jan 14 12:24:17 2010 -0800
Committer:     David Lutterkort <lutter at redhat.com>
CommitterDate: Thu Jan 14 14:48:38 2010 -0800

* src/lens.c (ambig_check): report OOM from fa_ambig_example

---
 src/lens.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/lens.c b/src/lens.c
index cb770ba..895178e 100644
--- a/src/lens.c
+++ b/src/lens.c
@@ -557,8 +557,19 @@ static struct value *ambig_check(struct info *info,
                                  const char *msg, bool iterated) {
     char *upv, *pv, *v;
     size_t upv_len;
-    fa_ambig_example(fa1, fa2, &upv, &upv_len, &pv, &v);
     struct value *exn = NULL;
+    int r;
+
+    r = fa_ambig_example(fa1, fa2, &upv, &upv_len, &pv, &v);
+    if (r < 0) {
+        exn = make_exn_value(ref(info), "not enough memory");
+        if (exn != NULL) {
+            return exn;
+        } else {
+            ERR_REPORT(info, AUG_ENOMEM, NULL);
+            return exn_error();
+        }
+    }
 
     if (upv != NULL) {
         char *e_u = escape(upv, pv - upv);




More information about the augeas-devel mailing list