libsysprof-capture: be more defensive

This commit is contained in:
Christian Hergert
2019-06-05 15:11:04 -07:00
parent 26c029b7a2
commit 400e5b81bc

View File

@ -165,7 +165,13 @@ sysprof_capture_writer_finalize (SysprofCaptureWriter *self)
if (self != NULL)
{
sysprof_capture_writer_flush (self);
close (self->fd);
if (self->fd != -1)
{
close (self->fd);
self->fd = -1;
}
g_free (self->buf);
g_free (self);
}