visionstream: fix doube fd close (#2057)
* s->ipc_fd counld be closed twice * white spacepull/2073/head
parent
727055e0a0
commit
17dd07e751
|
@ -90,6 +90,7 @@ int visionstream_init(VisionStream *s, VisionStreamType type, bool tbuffer, Visi
|
|||
err = vipc_send(s->ipc_fd, &p);
|
||||
if (err < 0) {
|
||||
close(s->ipc_fd);
|
||||
s->ipc_fd = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -97,6 +98,7 @@ int visionstream_init(VisionStream *s, VisionStreamType type, bool tbuffer, Visi
|
|||
err = vipc_recv(s->ipc_fd, &rp);
|
||||
if (err <= 0) {
|
||||
close(s->ipc_fd);
|
||||
s->ipc_fd = -1;
|
||||
return -1;
|
||||
}
|
||||
assert(rp.type == VIPC_STREAM_BUFS);
|
||||
|
@ -190,5 +192,5 @@ void visionstream_destroy(VisionStream *s) {
|
|||
}
|
||||
}
|
||||
if (s->bufs) free(s->bufs);
|
||||
close(s->ipc_fd);
|
||||
if (s->ipc_fd >= 0) close(s->ipc_fd);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue