summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2014-10-07 12:10:06 +0200
committerDaniel Mack <daniel@zonque.org>2014-10-07 12:10:06 +0200
commit8bf13eb1e02b9977ae1cd331ae5dc7305a305a09 (patch)
treeb886b5e31732b23aaf20c15fc62156874b4e025d /src/libsystemd/sd-bus
parent53e9dbcdfbae355aae8edb79d49e50a0ec3912d5 (diff)
sd-bus: check return value of vasprintf
Check for OOM situations when vasprintf() returns < 0 in bus_error_setfv(). Spotted by coverity.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-error.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
index abdfd73204..5ca974a191 100644
--- a/src/libsystemd/sd-bus/bus-error.c
+++ b/src/libsystemd/sd-bus/bus-error.c
@@ -194,8 +194,13 @@ int bus_error_setfv(sd_bus_error *e, const char *name, const char *format, va_li
return -ENOMEM;
}
- if (format)
- vasprintf((char**) &e->message, format, ap);
+ if (format) {
+ int r;
+
+ r = vasprintf((char**) &e->message, format, ap);
+ if (r < 0)
+ return -ENOMEM;
+ }
e->_need_free = 1;