File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -380,6 +380,7 @@ struct clip_ctx {
380
380
if (backend_cpu != backend) {
381
381
ggml_backend_free (backend_cpu);
382
382
}
383
+ clip_image_size_free (load_image_size);
383
384
}
384
385
};
385
386
@@ -1618,6 +1619,12 @@ struct clip_image_f32 * clip_image_f32_init() {
1618
1619
return new clip_image_f32 ();
1619
1620
}
1620
1621
1622
+ void clip_image_size_free (struct clip_image_size * load_image_size) {
1623
+ if (load_image_size == nullptr ) {
1624
+ return ;
1625
+ }
1626
+ delete load_image_size;
1627
+ }
1621
1628
void clip_image_u8_free (struct clip_image_u8 * img) { delete img; }
1622
1629
void clip_image_f32_free (struct clip_image_f32 * img) { delete img; }
1623
1630
void clip_image_u8_batch_free (struct clip_image_u8_batch * batch) {
@@ -2270,6 +2277,9 @@ ggml_tensor * clip_get_newline_tensor(const struct clip_ctx * ctx) {
2270
2277
}
2271
2278
2272
2279
void clip_free (clip_ctx * ctx) {
2280
+ if (ctx == nullptr ) {
2281
+ return ;
2282
+ }
2273
2283
delete ctx;
2274
2284
}
2275
2285
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ CLIP_API struct clip_image_size * clip_image_size_init();
77
77
CLIP_API struct clip_image_u8 * clip_image_u8_init ();
78
78
CLIP_API struct clip_image_f32 * clip_image_f32_init ();
79
79
80
+ CLIP_API void clip_image_size_free (struct clip_image_size * img_size );
80
81
CLIP_API void clip_image_u8_free (struct clip_image_u8 * img );
81
82
CLIP_API void clip_image_f32_free (struct clip_image_f32 * img );
82
83
CLIP_API void clip_image_u8_batch_free (struct clip_image_u8_batch * batch );
You can’t perform that action at this time.
0 commit comments