summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@dahyabhai.net>2014-03-13 17:00:06 -0400
committerNalin Dahyabhai <nalin@dahyabhai.net>2014-03-13 17:00:06 -0400
commit39f34e126a2cf13e60e59a1f06fa731348a7e2d0 (patch)
treef35e53a1ce54dba03cffb2d4d7d4e4f8f88e9a5c
parent772ea7675ddad6cd7dce045154562a0ab22629bb (diff)
downloadslapi-nis-39f34e126a2cf13e60e59a1f06fa731348a7e2d0.tar.gz
slapi-nis-39f34e126a2cf13e60e59a1f06fa731348a7e2d0.tar.xz
slapi-nis-39f34e126a2cf13e60e59a1f06fa731348a7e2d0.zip
Check for OOM in format_expand_simple()
-rw-r--r--src/format.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/format.c b/src/format.c
index e17fac0..ee6b8f3 100644
--- a/src/format.c
+++ b/src/format.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008,2010,2011,2012,2013 Red Hat, Inc.
+ * Copyright 2008,2010,2011,2012,2013,2014 Red Hat, Inc.
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -4089,6 +4089,9 @@ format_expand_simple(struct plugin_state *state,
replaceall = NULL;
replaceval = NULL;
expr = strdup(fmt);
+ if (expr == NULL) {
+ return -ENOMEM;
+ }
/* It's a simple expression, so evaluate it. Check for substitutions
* and text to be stripped if the magic character occurs before the
* default/alternate signals. */