Skip to content

Commit 734101d

Browse files
committed
to_value_from_struct: replace strcat with string+
Fixes leaking of the returned str from strcat
1 parent 8304aaa commit 734101d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/mknix.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ nix::Value mx_to_value_from_struct(const mxArray *arr) {
152152
case 3: val.encoder = mx_to_str(field_array_ptr); break;
153153
case 4: val.filename = mx_to_str(field_array_ptr); break;
154154
case 5: val.reference = mx_to_str(field_array_ptr); break;
155-
default: throw std::invalid_argument(strcat("Field is not supported: ", field_name));
155+
default: throw std::invalid_argument(std::string("Field is not supported: ") + std::string(field_name));
156156
}
157157
}
158158

@@ -188,4 +188,4 @@ std::vector<nix::Value> mx_to_values(const mxArray *arr) {
188188
}
189189

190190
return vals;
191-
}
191+
}

0 commit comments

Comments
 (0)