mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-23 07:53:43 +00:00
segfault fix
This commit is contained in:
@@ -59,10 +59,6 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
static void MemsinkObject_destroy_internals(MemsinkObject *self) {
|
static void MemsinkObject_destroy_internals(MemsinkObject *self) {
|
||||||
if (self->dict_frame != NULL) {
|
|
||||||
Py_DECREF(self->dict_frame);
|
|
||||||
self->dict_frame = NULL;
|
|
||||||
}
|
|
||||||
if (self->mem != NULL) {
|
if (self->mem != NULL) {
|
||||||
munmap(self->mem, sizeof(memsink_shared_s));
|
munmap(self->mem, sizeof(memsink_shared_s));
|
||||||
self->mem = NULL;
|
self->mem = NULL;
|
||||||
@@ -71,6 +67,10 @@ static void MemsinkObject_destroy_internals(MemsinkObject *self) {
|
|||||||
close(self->fd);
|
close(self->fd);
|
||||||
self->fd = -1;
|
self->fd = -1;
|
||||||
}
|
}
|
||||||
|
if (self->dict_frame != NULL) {
|
||||||
|
Py_DECREF(self->dict_frame);
|
||||||
|
self->dict_frame = NULL;
|
||||||
|
}
|
||||||
if (self->tmp_frame) {
|
if (self->tmp_frame) {
|
||||||
if (TMP(data)) {
|
if (TMP(data)) {
|
||||||
free(TMP(data));
|
free(TMP(data));
|
||||||
@@ -108,6 +108,10 @@ static int MemsinkObject_init(MemsinkObject *self, PyObject *args, PyObject *kwa
|
|||||||
TMP(allocated) = 512 * 1024;
|
TMP(allocated) = 512 * 1024;
|
||||||
A_REALLOC(TMP(data), TMP(allocated));
|
A_REALLOC(TMP(data), TMP(allocated));
|
||||||
|
|
||||||
|
if ((self->dict_frame = PyDict_New()) == NULL) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if ((self->fd = shm_open(self->obj, O_RDWR, 0)) == -1) {
|
if ((self->fd = shm_open(self->obj, O_RDWR, 0)) == -1) {
|
||||||
PyErr_SetFromErrno(PyExc_OSError);
|
PyErr_SetFromErrno(PyExc_OSError);
|
||||||
goto error;
|
goto error;
|
||||||
@@ -130,10 +134,6 @@ static int MemsinkObject_init(MemsinkObject *self, PyObject *args, PyObject *kwa
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((self->dict_frame = PyDict_New()) == NULL) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
|||||||
Reference in New Issue
Block a user