Fix crash in virNetDevGetVirtualFunctions
Fix crash in virNetDevGetVirtualFunctions

Commit 9a3ff01d7f16cc280ce3176620c0714f55511a65 (which was ACKed at
the end of January, but for some reason didn't get pushed until during
the 1.0.4 freeze) fixed the logic in virPCIGetVirtualFunctions().
Unfortunately, a typo in the fix (replacing VIR_REALLOC_N with
VIR_ALLOC_N during code movement) caused not only a memory leak, but
also resulted in most of the elements of the result array being
replaced with NULL. virNetDevGetVirtualFunctions() assumed (and I think
rightly so) that virPCIGetVirtualFunctions() wouldn't return any NULL
elements in the array, so it ended up segfaulting.

This was found when attempting to use a virtual network with an
auto-created pool of SRIOV VFs, e.g.:

    <forward mode='hostdev' managed='yes'>
      <pf dev='eth4'/>
    </forward>

(the pool of PCI addresses is discovered by calling
virNetDevGetVirtualFunctions() on the PF dev).

andreabolognani/libvirt,fabianfreyer/libvirt,agx/libvirt,jardasgit/libvirt,datto/libvirt,VenkatDatta/libvirt,elmarco/libvirt,cbosdo/libvirt,VenkatDatta/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,elmarco/libvirt,jardasgit/libvirt,jardasgit/libvirt,andreabolognani/libvirt,jfehlig/libvirt,shugaoye/libvirt,shugaoye/libvirt,jfehlig/libvirt,andreabolognani/libvirt,zhlcindy/libvirt-1.1.4-maintain,taget/libvirt,zippy2/libvirt,datto/libvirt,jardasgit/libvirt,eskultety/libvirt,andreabolognani/libvirt,zippy2/libvirt,jfehlig/libvirt,olafhering/libvirt,shugaoye/libvirt,nertpinx/libvirt,libvirt/libvirt,eskultety/libvirt,rlaager/libvirt,fabianfreyer/libvirt,rlaager/libvirt,cbosdo/libvirt,eskultety/libvirt,zippy2/libvirt,shugaoye/libvirt,fabianfreyer/libvirt,agx/libvirt,VenkatDatta/libvirt,datto/libvirt,jfehlig/libvirt,VenkatDatta/libvirt,zhlcindy/libvirt-1.1.4-maintain,nertpinx/libvirt,olafhering/libvirt,taget/libvirt,taget/libvirt,zippy2/libvirt,andreabolognani/libvirt,rlaager/libvirt,jardasgit/libvirt,VenkatDatta/libvirt,cbosdo/libvirt,fabianfreyer/libvirt,crobinso/libvirt,eskultety/libvirt,cbosdo/libvirt,datto/libvirt,elmarco/libvirt,agx/libvirt,agx/libvirt,rlaager/libvirt,agx/libvirt,elmarco/libvirt,taget/libvirt,crobinso/libvirt,zhlcindy/libvirt-1.1.4-maintain,cbosdo/libvirt,olafhering/libvirt,nertpinx/libvirt,zhlcindy/libvirt-1.1.4-maintain,libvirt/libvirt,olafhering/libvirt,crobinso/libvirt,elmarco/libvirt,crobinso/libvirt,rlaager/libvirt,taget/libvirt,nertpinx/libvirt,eskultety/libvirt,shugaoye/libvirt,libvirt/libvirt,zhlcindy/libvirt-1.1.4-maintain,libvirt/libvirt,datto/libvirt