summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Brown2017-03-22 13:41:01 +0100
committerMichael Brown2017-03-22 13:41:01 +0100
commit01496a50282542fbac98b16ed40cbe52d7d6161d (patch)
tree98762defcc227351535fab30d5385191feab5a2a /src
parent[usb] Use correct length for memcpy() (diff)
downloadipxe-01496a50282542fbac98b16ed40cbe52d7d6161d.tar.gz
ipxe-01496a50282542fbac98b16ed40cbe52d7d6161d.tar.xz
ipxe-01496a50282542fbac98b16ed40cbe52d7d6161d.zip
[xen] Use standard calling pattern for asprintf()
Our asprintf() implementation guarantees that strp will be NULL on allocation failure, but this is not standard behaviour. Detect errors by checking for a negative return value instead of a NULL pointer. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src')
-rw-r--r--src/interface/xen/xenstore.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/interface/xen/xenstore.c b/src/interface/xen/xenstore.c
index 23424a92..a14881fc 100644
--- a/src/interface/xen/xenstore.c
+++ b/src/interface/xen/xenstore.c
@@ -538,8 +538,7 @@ void xenstore_dump ( struct xen_hypervisor *xen, const char *key ) {
child += ( strlen ( child ) + 1 /* NUL */ ) ) {
/* Construct child key */
- asprintf ( &child_key, "%s/%s", key, child );
- if ( ! child_key ) {
+ if ( asprintf ( &child_key, "%s/%s", key, child ) < 0 ){
DBGC ( xen, "XENSTORE could not allocate child "
"key \"%s/%s\"\n", key, child );
rc = -ENOMEM;