Set old declaration to NULL when retry
[babeltrace.git] / formats / ctf / metadata / ctf-visitor-generate-io-struct.c
index 2eba30bd46d3475cf9a2c74e679646bba7fef119..f0e5b4744667d7a1e8a52f638082ba32e4727f9a 100644 (file)
@@ -1905,7 +1905,10 @@ int ctf_trace_declaration_visit(FILE *fd, int depth, struct ctf_node *node, stru
                                         * construction of the
                                         * intermediate representation.
                                         */
-                                       return -EINTR;
+                                       trace->field_mask = 0;
+                                       CTF_TRACE_SET_FIELD(trace, byte_order);
+                                       ret = -EINTR;
+                                       goto error;
                                }
                        }
                        CTF_TRACE_SET_FIELD(trace, byte_order);
@@ -1997,14 +2000,15 @@ restart:
        return 0;
 
 error:
-       if (trace->packet_header_decl)
+       if (trace->packet_header_decl) {
                declaration_unref(&trace->packet_header_decl->p);
+               trace->packet_header_decl = NULL;
+       }
        g_ptr_array_free(trace->streams, TRUE);
        free_declaration_scope(trace->declaration_scope);
        trace->declaration_scope = NULL;
        /* byte order changed while creating types, retry. */
        if (ret == -EINTR) {
-               trace->field_mask = 0;
                goto restart;
        }
        return ret;
This page took 0.023456 seconds and 4 git commands to generate.