File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -380,6 +380,7 @@ struct clip_ctx {
380380        if  (backend_cpu != backend) {
381381            ggml_backend_free (backend_cpu);
382382        }
383+         clip_image_size_free (load_image_size);
383384    }
384385};
385386
@@ -1618,6 +1619,12 @@ struct clip_image_f32 * clip_image_f32_init() {
16181619    return  new  clip_image_f32 ();
16191620}
16201621
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+ }
16211628void  clip_image_u8_free (struct  clip_image_u8   * img) { delete  img; }
16221629void  clip_image_f32_free (struct  clip_image_f32  * img) { delete  img; }
16231630void  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) {
22702277}
22712278
22722279void  clip_free (clip_ctx * ctx) {
2280+     if  (ctx == nullptr ) {
2281+         return ;
2282+     }
22732283    delete  ctx;
22742284}
22752285
Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ CLIP_API struct clip_image_size * clip_image_size_init();
7777CLIP_API  struct  clip_image_u8   *  clip_image_u8_init  ();
7878CLIP_API  struct  clip_image_f32  *  clip_image_f32_init ();
7979
80+ CLIP_API  void  clip_image_size_free  (struct  clip_image_size  *  img_size );
8081CLIP_API  void  clip_image_u8_free  (struct  clip_image_u8   *  img );
8182CLIP_API  void  clip_image_f32_free (struct  clip_image_f32  *  img );
8283CLIP_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