+ /* First we allocate and initialise our netlist struct */
+ p_input->p_method_data = malloc(sizeof(netlist_t));
+ if ( p_input->p_method_data == NULL )
+ {
+ intf_ErrMsg("Unable to malloc the netlist struct");
+ return (-1);
+ }
+
+ p_netlist = (netlist_t *) p_input->p_method_data;
+
+ p_netlist->i_read_once = i_read_once;
+
+ /* allocate the buffers */
+ p_netlist->p_buffers =
+ (byte_t *) malloc(i_buffer_size* i_nb_data );
+ if ( p_netlist->p_buffers == NULL )
+ {
+ intf_ErrMsg ("Unable to malloc in netlist initialization (1)");
+ return (-1);
+ }
+
+ p_netlist->p_data =
+ (data_packet_t *) malloc(sizeof(data_packet_t)*(i_nb_data));
+ if ( p_netlist->p_data == NULL )
+ {
+ intf_ErrMsg ("Unable to malloc in netlist initialization (2)");
+ return (-1);
+ }
+
+ p_netlist->p_pes =
+ (pes_packet_t *) malloc(sizeof(pes_packet_t)*(i_nb_pes));
+ if ( p_netlist->p_pes == NULL )
+ {
+ intf_ErrMsg ("Unable to malloc in netlist initialization (3)");
+ return (-1);
+ }
+
+ /* allocate the FIFOs */
+ p_netlist->pp_free_data =
+ (data_packet_t **) malloc (i_nb_data * sizeof(data_packet_t *) );
+ if ( p_netlist->pp_free_data == NULL )
+ {
+ intf_ErrMsg ("Unable to malloc in netlist initialization (4)");
+ }
+ p_netlist->pp_free_pes =
+ (pes_packet_t **) malloc (i_nb_pes * sizeof(pes_packet_t *) );
+ if ( p_netlist->pp_free_pes == NULL )
+ {
+ intf_ErrMsg ("Unable to malloc in netlist initialization (5)");
+ }
+
+ p_netlist->p_free_iovec = ( struct iovec * )
+ malloc( (i_nb_data + p_netlist->i_read_once) * sizeof(struct iovec) );
+ if ( p_netlist->p_free_iovec == NULL )