On 04/29/2013 09:50 AM, Michal Privoznik wrote:
---
src/storage/parthelper.c | 7 ++++---
src/storage/storage_backend.c | 16 ++++++----------
src/storage/storage_backend_disk.c | 14 +++++++-------
src/storage/storage_backend_fs.c | 17 ++++++++---------
src/storage/storage_backend_iscsi.c | 14 ++++++--------
src/storage/storage_backend_logical.c | 24 ++++++++++++------------
src/storage/storage_backend_mpath.c | 3 +--
src/storage/storage_backend_rbd.c | 3 +--
src/storage/storage_backend_scsi.c | 16 +++++++---------
src/storage/storage_driver.c | 11 +++++------
10 files changed, 57 insertions(+), 68 deletions(-)
...
diff --git a/src/storage/storage_backend.c
b/src/storage/storage_backend.c
index b85a5a9..f14de87 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
...
@@ -1556,8 +1553,7 @@
virStorageBackendRunProgRegex(virStoragePoolObjPtr pool,
for (j = 0 ; j < nvars[i] ; j++) {
/* NB vars[0] is the full pattern, so we offset j by 1 */
p[vars[j+1].rm_eo] = '\0';
- if ((groups[ngroup++] =
- strdup(p + vars[j+1].rm_so)) == NULL) {
+ if (VIR_STRDUP(groups[ngroup++], p + vars[j+1].rm_so) < 0) {
Here's somewhere that we do the auto-increment inside the VIR_STRDUP() -
just as a note/followup to 12/37 w/r/t Eric's comment about auto
increment inside an all-caps macro.
Not a problem, but just pointing just in case it's felt that no
autoincrement should be done inside the macro...
...
diff --git a/src/storage/storage_driver.c
b/src/storage/storage_driver.c
index 990f0b1..824f501 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
...
@@ -1117,7 +1117,7 @@ storagePoolListVolumes(virStoragePoolPtr obj,
}
for (i = 0 ; i < pool->volumes.count && n < maxnames ; i++) {
- if ((names[n++] = strdup(pool->volumes.objs[i]->name)) == NULL) {
+ if (VIR_STRDUP(names[n++], pool->volumes.objs[i]->name) < 0) {
And another...