]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qparams.c: do not skip va_end, twice
authorJim Meyering <meyering@redhat.com>
Thu, 18 Feb 2010 19:27:22 +0000 (20:27 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 19 Feb 2010 10:52:04 +0000 (11:52 +0100)
* src/util/qparams.c (new_qparam_set, append_qparams): Do not skip
va_end due to an early return.

src/util/qparams.c

index 9535ca4f4caf70fa82b15fc0f9289aadb128dc9f..f6d0713cc63966acf25d307d8f2be17a1a538ab1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2009 Red Hat, Inc.
+/* Copyright (C) 2007, 2009-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -62,7 +62,8 @@ new_qparam_set (int init_alloc, ...)
 
         if (append_qparam (ps, pname, pvalue) == -1) {
             free_qparam_set (ps);
-            return NULL;
+            ps = NULL;
+            break;
         }
     }
     va_end (args);
@@ -75,17 +76,20 @@ append_qparams (struct qparam_set *ps, ...)
 {
     va_list args;
     const char *pname, *pvalue;
+    int ret = 0;
 
     va_start (args, ps);
     while ((pname = va_arg (args, char *)) != NULL) {
         pvalue = va_arg (args, char *);
 
-        if (append_qparam (ps, pname, pvalue) == -1)
-            return -1;
+        if (append_qparam (ps, pname, pvalue) == -1) {
+            ret = -1;
+            break;
+        }
     }
     va_end (args);
 
-    return 0;
+    return ret;
 }
 
 /* Ensure there is space to store at least one more parameter