[sysprof] libsysprof-capture: be more defensive



commit 400e5b81bc65112125c252d3b6cd0b4f9d7bb87b
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 5 15:11:04 2019 -0700

    libsysprof-capture: be more defensive

 src/libsysprof-capture/sysprof-capture-writer.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c
index 6c6c01a..477465a 100644
--- a/src/libsysprof-capture/sysprof-capture-writer.c
+++ b/src/libsysprof-capture/sysprof-capture-writer.c
@@ -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);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]