patch-src_pyvorbisfile_c 943 B

12345678910111213141516171819202122232425262728293031323334353637
  1. $OpenBSD: patch-src_pyvorbisfile_c,v 1.1.1.1 2011/05/31 09:19:45 dcoppa Exp $
  2. Fixes for python2.5 memory management
  3. Fix redundant double free
  4. (from Debian's patchset for python-pyvorbis)
  5. --- src/pyvorbisfile.c.orig Fri Dec 19 08:11:02 2003
  6. +++ src/pyvorbisfile.c Tue Jun 8 08:27:27 2010
  7. @@ -171,10 +171,9 @@ py_file_new(PyObject *self, PyObject *args) /* change
  8. ret = py_ov_open(newobj, args);
  9. if (ret == NULL) {
  10. - PyMem_DEL(newobj);
  11. + PyObject_Del(newobj);
  12. return NULL;
  13. - } else
  14. - Py_DECREF(ret);
  15. + }
  16. return (PyObject *) newobj;
  17. }
  18. @@ -190,12 +189,10 @@ py_ov_file_dealloc(PyObject *self)
  19. /* If file was opened from a file object, decref it, so it can
  20. close */
  21. Py_DECREF(py_self->py_file);
  22. - } else {
  23. - /* Otherwise, we opened the file and should close it. */
  24. - fclose(py_self->c_file);
  25. }
  26. - PyMem_DEL(self);
  27. + free(py_self->ovf);
  28. + PyObject_Del(self);
  29. }
  30. static PyObject *