On 04/29/2013 09:50 AM, Michal Privoznik wrote:
---
src/node_device/node_device_driver.c | 28 ++++------
src/node_device/node_device_hal.c | 13 ++---
src/node_device/node_device_udev.c | 102 +++++++++++++++--------------------
3 files changed, 60 insertions(+), 83 deletions(-)
...
@@ -388,8 +385,7 @@ nodeDeviceListCaps(virNodeDevicePtr dev, char
**const names, int maxnames)
}
for (caps = obj->def->caps; caps && ncaps < maxnames; caps =
caps->next) {
- names[ncaps] = strdup(virNodeDevCapTypeToString(caps->type));
- if (names[ncaps++] == NULL) {
+ if (VIR_STRDUP(names[ncaps], virNodeDevCapTypeToString(caps->type)) < 0) {
Lost the autoincrement ^^^
virReportOOMError();
goto cleanup;
}
...
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -445,10 +445,10 @@ static void dev_create(const char *udi)
virNodeDeviceDefPtr def = NULL;
const char *name = hal_name(udi);
int rv;
- char *privData = strdup(udi);
+ char *privData;
char *devicePath = NULL;
- if (!privData)
+ if (VIR_STRDUP(privDatam udi) < 0)
s/m/,/
...