]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Coverity: Fix the forward_null error in Python binding codes
authorOsier Yang <jyang@redhat.com>
Wed, 2 May 2012 15:05:59 +0000 (23:05 +0800)
committerCole Robinson <crobinso@redhat.com>
Thu, 7 Jun 2012 22:15:49 +0000 (18:15 -0400)
Related coverity log:

Error: FORWARD_NULL:
/builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:355:
assign_zero: Assigning: "params" = 0.
/builddir/build/BUILD/libvirt-0.9.10/python/libvirt-override.c:458:
var_deref_model: Passing null variable "params" to function
"getPyVirTypedParameter", which dereferences it. (The dereference is assumed on
the basis of the 'nonnull' parameter attribute.)
(cherry picked from commit b80f4db9931ceea4bec1d178322058df77ece7a4)

python/libvirt-override.c

index 56f96babc5c4f6f6b6b860b0605b8e99e8706df4..130e702d84785e171c71a8e1acb38a1b4d75cb44 100644 (file)
@@ -71,7 +71,7 @@ static char *py_str(PyObject *obj)
 /* Helper function to convert a virTypedParameter output array into a
  * Python dictionary for return to the user.  Return NULL on failure,
  * after raising a python exception.  */
-static PyObject * ATTRIBUTE_NONNULL(1)
+static PyObject *
 getPyVirTypedParameter(const virTypedParameterPtr params, int nparams)
 {
     PyObject *key, *val, *info;