• E
    maint: don't leave garbage on early API exit · c05aebfd
    Eric Blake 提交于
    Several APIs clear out a user input buffer before attempting to
    populate it; but in a few cases we missed this memset if we
    detect a reason for an early exit.  Note that these APIs
    check for non-NULL arguments, and exit early with an error
    message when NULL is passed in; which means that we must be
    careful to avoid a NULL deref in order to get to that error
    message.  Also, we were inconsistent on the use of
    sizeof(virType) vs. sizeof(expression); the latter is more
    robust if we ever change the type of the expression (although
    such action is unlikely since these types are part of our
    public API).
    
    * src/libvirt.c (virDomainGetInfo, virDomainGetBlockInfo)
    (virStoragePoolGetInfo, virStorageVolGetInfo)
    (virDomainGetJobInfo, virDomainGetBlockJobInfo): Move memset
    before any returns.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    c05aebfd
libvirt.c 605.7 KB