Skip to content

Commit 57b0557

Browse files
committed
Fix use_after_free (hopefully)
1 parent b900909 commit 57b0557

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

flux.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ namespace Flux {
10021002
public:
10031003
FluxParams flux_params;
10041004
Flux flux;
1005-
std::vector<float> pe_vec; // for cache
1005+
std::vector<float> pe_vec, range; // for cache
10061006
SDVersion version;
10071007

10081008
FluxRunner(ggml_backend_t backend,
@@ -1090,8 +1090,8 @@ namespace Flux {
10901090
y = to_backend(y);
10911091
} else {
10921092
// ggml_arrange is not working on some backends, and y isn't used, so let's reuse y to precompute it
1093-
std::vector<float> range = arange(0, 344);
1094-
y = ggml_new_tensor_1d(compute_ctx, GGML_TYPE_F32, range.size());
1093+
range = arange(0, 344);
1094+
y = ggml_new_tensor_1d(compute_ctx, GGML_TYPE_F32, range.size());
10951095
set_backend_tensor_data(y, range.data());
10961096
}
10971097
timesteps = to_backend(timesteps);

0 commit comments

Comments
 (0)