]> git.ipfire.org Git - thirdparty/libvirt.git/commit
rpc: Fix potentially segfaults
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Thu, 9 Feb 2017 14:13:38 +0000 (15:13 +0100)
committerLaine Stump <laine@laine.org>
Sun, 12 Feb 2017 20:02:42 +0000 (15:02 -0500)
commitd6bc7622f07b09ad569d2e9475e668981df06bed
treeb407c7ccc8de2c182c6e5a20b51075b692e5bec7
parent5620c609596cdfb3b809afab1b37b7f00fe831a1
rpc: Fix potentially segfaults

We have to allocate first and if, and only if, it was successful we
can set the count. A segfault has occurred in
virNetServerServiceNewPostExecRestart() when VIR_ALLOC_N(svc->socks,
n) has failed, but svc->nsocsk = n was already set. Thus
virObejectUnref(svc) was called and therefore it was possible that
virNetServerServiceDispose was called => segmentation fault.  For
safeness NULL pointer check were added in
virNetServerServiceDispose().

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
src/rpc/virnetserverservice.c