[libvirt] libvirt-python: memory leak after GetXMLDesc?

Junichi Nomura j-nomura at ce.jp.nec.com
Fri Sep 12 06:56:10 UTC 2014


Hello,

I've observed memory leak in long-running python program and
suspects a bug in libvirt-python.

libvirt-python contains auto-generated code like this:

  libvirt_virDomainGetXMLDesc(...) {
    ...
    LIBVIRT_BEGIN_ALLOW_THREADS;
    c_retval = virDomainGetXMLDesc(domain, flags);
    LIBVIRT_END_ALLOW_THREADS;
    py_retval = libvirt_charPtrWrap((char *) c_retval);
    return py_retval;
  }

virDomainGetXMLDesc() expects the caller to free c_retval.

Though it used to be freed in libvirt_charPtrWrap(), commit bb3301ba
("Don't free passed in args in libvirt_charPtrWrap /
libvirt_charPtrSizeWrap") has moved the responsibility to the outside.

So, it seems either GetXMLDesc should not depend on auto-generation or
the generator should be fixed.

Any comments?
-- 
Jun'ichi Nomura, NEC Corporation




More information about the libvir-list mailing list