diff --git a/src/half_edge_AS.c b/src/half_edge_AS.c index 519226e..32dc5e6 100644 --- a/src/half_edge_AS.c +++ b/src/half_edge_AS.c @@ -208,8 +208,7 @@ static bool assemble_obj_arrays(char const * const obj_string, str_tmp_ptr = strtok_r(NULL, "\n", &str_ptr_newline); } - free(string); - + /* set all out-variables */ *obj_v_out = obj_v; *obj_vt_out = obj_vt; obj_f->v = obj_f_v; @@ -220,6 +219,9 @@ static bool assemble_obj_arrays(char const * const obj_string, *ec_out = ec; *vtc_out = vtc; + /* cleanup */ + free(string); + return true; }