capture-writer: finalize if allocate failed

This commit is contained in:
Christian Hergert
2016-11-20 20:26:34 -08:00
parent e97499b2a4
commit f11aaa189f

View File

@ -433,8 +433,12 @@ sp_capture_writer_new_from_fd (int fd,
nowstr = g_time_val_to_iso8601 (&tv);
header = sp_capture_writer_allocate (self, &header_len);
if (!header)
return NULL;
if (header == NULL)
{
sp_capture_writer_finalize (self);
return NULL;
}
header->magic = SP_CAPTURE_MAGIC;
header->version = 1;