File tree Expand file tree Collapse file tree
product-mini/platforms/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -222,14 +222,12 @@ wasi_nn_parse(char **argv, wasi_nn_parse_context_t *ctx)
222222 goto fail ;
223223 }
224224
225- ctx -> model_names [ctx -> n_graphs ] = strdup ( tokens [0 ]) ;
226- ctx -> encoding [ctx -> n_graphs ] = strdup ( tokens [1 ]) ;
227- ctx -> target [ctx -> n_graphs ] = strdup ( tokens [2 ]) ;
228- ctx -> graph_paths [ctx -> n_graphs ++ ] = strdup ( tokens [3 ]) ;
225+ ctx -> model_names [ctx -> n_graphs ] = tokens [0 ];
226+ ctx -> encoding [ctx -> n_graphs ] = tokens [1 ];
227+ ctx -> target [ctx -> n_graphs ] = tokens [2 ];
228+ ctx -> graph_paths [ctx -> n_graphs ++ ] = tokens [3 ];
229229
230230fail :
231- if (token )
232- free (token );
233231
234232 return ret ;
235233}
@@ -243,16 +241,5 @@ wasi_nn_set_init_args(struct InstantiationArgs2 *args,
243241 ctx -> encoding , ctx -> target , ctx -> n_graphs ,
244242 ctx -> graph_paths );
245243 wasm_runtime_instantiation_args_set_wasi_nn_registry (args , nn_registry );
246-
247- for (uint32_t i = 0 ; i < ctx -> n_graphs ; i ++ ) {
248- if (ctx -> model_names [i ])
249- free (ctx -> model_names [i ]);
250- if (ctx -> graph_paths [i ])
251- free (ctx -> graph_paths [i ]);
252- if (ctx -> encoding [i ])
253- free (ctx -> encoding [i ]);
254- if (ctx -> target [i ])
255- free (ctx -> target [i ]);
256- }
257244}
258245#endif
You can’t perform that action at this time.
0 commit comments