static int read_free( Read *read ) { VIPS_FREE( read->filename ); VIPS_FREEF( WebPIDelete, read->idec ); WebPFreeDecBuffer( &read->config.output ); VIPS_FREE( read ); return( 0 ); }
static int vips_reducev_stop( void *vseq, void *a, void *b ) { Sequence *seq = (Sequence *) vseq; VIPS_UNREF( seq->ir ); VIPS_FREE( seq->t1 ); VIPS_FREE( seq->t2 ); return( 0 ); }
static void vips_buildlut_dispose( GObject *gobject ) { VipsBuildlut *lut = (VipsBuildlut *) gobject; VIPS_FREE( lut->data ); VIPS_FREE( lut->buf ); VIPS_UNREF( lut->mat ); G_OBJECT_CLASS( vips_buildlut_parent_class )->dispose( gobject ); }
static void write_destroy( Write *write ) { jpeg_destroy_compress( &write->cinfo ); VIPS_FREEF( fclose, write->eman.fp ); VIPS_FREE( write->row_pointer ); VIPS_FREE( write->profile_bytes ); VIPS_UNREF( write->inverted ); g_free( write ); }
/* Free a sequence value. */ static int vips_convi_stop( void *vseq, void *a, void *b ) { VipsConviSequence *seq = (VipsConviSequence *) vseq; VIPS_UNREF( seq->ir ); VIPS_FREE( seq->offsets ); VIPS_FREE( seq->t1 ); VIPS_FREE( seq->t2 ); return( 0 ); }
static void vips_foreign_save_dz_dispose( GObject *gobject ) { VipsForeignSaveDz *dz = (VipsForeignSaveDz *) gobject; VIPS_FREEF( layer_free, dz->layer ); VIPS_FREEF( vips_gsf_tree_free, dz->tree ); VIPS_FREE( dz->basename ); VIPS_FREE( dz->dirname ); VIPS_FREE( dz->tempdir ); VIPS_FREE( dz->root_name ); VIPS_FREE( dz->file_suffix ); G_OBJECT_CLASS( vips_foreign_save_dz_parent_class )->dispose( gobject ); }
static void vips_reducev_finalize( GObject *gobject ) { VipsReducev *reducev = (VipsReducev *) gobject; for( int i = 0; i < reducev->n_pass; i++ ) VIPS_FREEF( vips_vector_free, reducev->pass[i].vector ); reducev->n_pass = 0; for( int i = 0; i < VIPS_TRANSFORM_SCALE + 1; i++ ) { VIPS_FREE( reducev->matrixf[i] ); VIPS_FREE( reducev->matrixi[i] ); VIPS_FREE( reducev->matrixo[i] ); } G_OBJECT_CLASS( vips_reducev_parent_class )->finalize( gobject ); }
/* Can be called many times. */ static void read_free( Read *read ) { #ifdef DEBUG printf( "magick2vips: read_free: %s\n", read->filename ); #endif /*DEBUG*/ VIPS_FREE( read->filename ); VIPS_FREEF( DestroyImageList, read->image ); VIPS_FREEF( DestroyImageInfo, read->image_info ); VIPS_FREE( read->frames ); if ( (&read->exception)->signature == MagickSignature ) { DestroyExceptionInfo( &read->exception ); } VIPS_FREEF( vips_g_mutex_free, read->lock ); }
static void vips_thread_gate_free( VipsThreadGate *gate ) { VIPS_FREEF( vips_thread_gate_block_free, gate->start ); VIPS_FREEF( vips_thread_gate_block_free, gate->stop ); VIPS_FREE( gate ); }
static int read_destroy( VipsImage *im, Read *read ) { #ifdef DEBUG printf( "magick2vips: read_destroy: %s\n", read->filename ); #endif /*DEBUG*/ VIPS_FREE( read->filename ); VIPS_FREEF( DestroyImage, read->image ); VIPS_FREEF( DestroyImageInfo, read->image_info ); VIPS_FREE( read->frames ); DestroyExceptionInfo( &read->exception ); VIPS_FREEF( g_mutex_free, read->lock ); return( 0 ); }
static void write_destroy( Write *write ) { VIPS_FREEF( fclose, write->fp ); VIPS_FREE( write->name ); vips_free( write ); }
void vips_vector_free( VipsVector *vector ) { #ifdef HAVE_ORC VIPS_FREEF( orc_program_free, vector->program ); #endif /*HAVE_ORC*/ VIPS_FREE( vector ); }
/* Can be called many times. */ static void read_destroy( Read *read ) { VIPS_FREEF( fclose, read->fp ); if( read->pPng ) png_destroy_read_struct( &read->pPng, &read->pInfo, NULL ); VIPS_FREE( read->row_pointer ); }
static void vips_system_dispose( GObject *gobject ) { VipsSystem *system = (VipsSystem *) gobject; if( system->in_name ) { int i; for( i = 0; i < system->in->n; i++ ) { g_unlink( system->in_name[i] ); VIPS_FREE( system->in_name[i] ); } } VIPS_FREE( system->out_name ); G_OBJECT_CLASS( vips_system_parent_class )->dispose( gobject ); }
/** * vips_buf_destroy: * @buf: the buffer * * Destroy a buffer. Only needed for heap buffers. Leaves the buffer in the * _init state. */ void vips_buf_destroy( VipsBuf *buf ) { if( buf->dynamic ) { VIPS_FREE( buf->base ); } vips_buf_init( buf ); }
static void read_destroy( Read *read ) { VIPS_FREE( read->filename ); VIPS_FREEF( Mat_VarFree, read->var ); VIPS_FREEF( Mat_Close, read->mat ); vips_free( read ); }
static void vips_thread_profile_free( VipsThreadProfile *profile ) { VIPS_DEBUG_MSG( "vips_thread_profile_free: %s\n", profile->name ); VIPS_FREEF( g_hash_table_destroy, profile->gates ); VIPS_FREEF( vips_thread_gate_free, profile->memory ); VIPS_FREE( profile ); }
static void write_finish( Write *write ) { VIPS_FREEF( fclose, write->fp ); VIPS_UNREF( write->memory ); VIPS_FREE( write->buf ); if( write->pPng ) png_destroy_write_struct( &write->pPng, &write->pInfo ); }
static int vips_worley_stop( void *vseq, void *a, void *b ) { Sequence *seq = (Sequence *) vseq; VIPS_FREE( seq ); return( 0 ); }
/* Shut down. Can be called many times. */ static void vips_fits_close( VipsFits *fits ) { VIPS_FREE( fits->filename ); VIPS_FREEF( vips_g_mutex_free, fits->lock ); if( fits->fptr ) { int status; status = 0; if( fits_close_file( fits->fptr, &status ) ) vips_fits_error( status ); fits->fptr = NULL; } VIPS_FREE( fits->buffer ); }
/* INTMASK destroy function. */ static int imask_dest( im_object obj ) { im_mask_object *mo = obj; VIPS_FREE( mo->name ); VIPS_FREEF( im_free_imask, mo->mask ); return( 0 ); }
static void vips_text_dispose( GObject *gobject ) { VipsText *text = (VipsText *) gobject; VIPS_UNREF( text->layout ); VIPS_UNREF( text->context ); VIPS_FREE( text->bitmap.buffer ); G_OBJECT_CLASS( vips_text_parent_class )->dispose( gobject ); }
static int read_free( Read *read ) { VIPS_FREEF( WebPIDelete, read->idec ); WebPFreeDecBuffer( &read->config.output ); if( read->fd > 0 && read->data && read->length > 0 ) { vips__munmap( read->data, read->length ); read->data = NULL; read->length = 0; } VIPS_FREEF( vips_tracked_close, read->fd ); VIPS_FREE( read->filename ); VIPS_FREE( read ); return( 0 ); }
void vips_vector_free( VipsVector *vector ) { #ifdef HAVE_ORC /* orc-0.4.19 will crash if you free programs. Update your orc, or * comment out this line. * * See https://bugzilla.gnome.org/show_bug.cgi?id=731227 * * orc does not set any version variables so we can't disable this * free automatically. */ #ifdef DEBUG_TRACE printf( "orc_program_free( %s );\n", vector->unique_name ); printf( "%s = NULL;\n", vector->unique_name ); #endif /*DEBUG_TRACE*/ VIPS_FREEF( orc_program_free, vector->program ); #endif /*HAVE_ORC*/ VIPS_FREE( vector->unique_name ); VIPS_FREE( vector ); }
static void buffer_cache_free( VipsBufferCache *cache ) { #ifdef DEBUG_CREATE buffer_cache_n -= 1; printf( "buffer_cache_free: freeing cache %p on thread %p\n", cache, g_thread_self() ); printf( "\t(%d cachees left)\n", buffer_cache_n ); #endif /*DEBUG_CREATE*/ VIPS_FREEF( g_hash_table_destroy, cache->hash ); VIPS_FREE( cache ); }
static void vips_foreign_load_magick7_dispose( GObject *gobject ) { VipsForeignLoadMagick7 *magick7 = (VipsForeignLoadMagick7 *) gobject; int i; #ifdef DEBUG printf( "vips_foreign_load_magick7_dispose: %p\n", gobject ); #endif /*DEBUG*/ for( i = 0; i < magick7->n_frames; i++ ) { VIPS_FREEF( DestroyCacheView, magick7->cache_view[i] ); } VIPS_FREEF( DestroyImageList, magick7->image ); VIPS_FREEF( DestroyImageInfo, magick7->image_info ); VIPS_FREE( magick7->frames ); VIPS_FREE( magick7->cache_view ); VIPS_FREEF( magick_destroy_exception, magick7->exception ); VIPS_FREEF( vips_g_mutex_free, magick7->lock ); G_OBJECT_CLASS( vips_foreign_load_magick7_parent_class )-> dispose( gobject ); }
/* Junk stuff we may have attached to vargv. */ static void vips_wrap7_vargv_finalize( im_function *fn, im_object *vargv ) { int i; for( i = 0; i < fn->argc; i++ ) { im_arg_desc *arg = &fn->argv[i]; im_type_desc *type = arg->desc; im_arg_type vt = type->type; switch( vips_wrap7_lookup_type( vt ) ) { case VIPS_WRAP7_NONE: /* IM_TYPE_DISPLAY */ case VIPS_WRAP7_DOUBLE: case VIPS_WRAP7_INT: case VIPS_WRAP7_COMPLEX: case VIPS_WRAP7_GVALUE: case VIPS_WRAP7_INTERPOLATE: case VIPS_WRAP7_IMAGE: /* Do nothing. */ break; case VIPS_WRAP7_STRING: VIPS_FREE( vargv[i] ); break; case VIPS_WRAP7_IMAGEVEC: VIPS_FREE( ((im_imagevec_object *) vargv[i])->vec ); break; case VIPS_WRAP7_DOUBLEVEC: VIPS_FREE( ((im_doublevec_object *) vargv[i])->vec ); break; case VIPS_WRAP7_INTVEC: VIPS_FREE( ((im_intvec_object *) vargv[i])->vec ); break; case VIPS_WRAP7_DMASK: VIPS_FREE( ((im_mask_object *) vargv[i])->name ); VIPS_FREEF( im_free_dmask, ((im_mask_object *) vargv[i])->mask ); break; case VIPS_WRAP7_IMASK: VIPS_FREE( ((im_mask_object *) vargv[i])->name ); VIPS_FREEF( im_free_imask, ((im_mask_object *) vargv[i])->mask ); break; default: g_assert( FALSE ); } } }
static void vips_wrap7_finalize( GObject *gobject ) { VipsWrap7 *wrap7 = VIPS_WRAP7( gobject ); VipsWrap7Class *class = VIPS_WRAP7_GET_CLASS( wrap7 ); #ifdef DEBUG printf( "vips_wrap7_finalize: " ); vips_object_print_name( VIPS_OBJECT( wrap7 ) ); printf( "\n" ); #endif /*DEBUG*/ if( wrap7->vargv ) { vips_wrap7_vargv_finalize( class->fn, wrap7->vargv ); im_free_vargv( class->fn, wrap7->vargv ); VIPS_FREE( wrap7->vargv ); }
/* This can be called many times. */ static int readjpeg_free( ReadJpeg *jpeg ) { int result; result = 0; if( jpeg->eman.pub.num_warnings != 0 ) { if( jpeg->fail ) { vips_error( "VipsJpeg", "%s", vips_error_buffer() ); result = -1; } else { vips_warn( "VipsJpeg", _( "read gave %ld warnings" ), jpeg->eman.pub.num_warnings ); vips_warn( NULL, "%s", vips_error_buffer() ); } /* Make the message only appear once. */ jpeg->eman.pub.num_warnings = 0; } /* Don't call jpeg_finish_decompress(). It just checks the tail of the * file and who cares about that. All mem is freed in * jpeg_destroy_decompress(). */ VIPS_FREEF( fclose, jpeg->eman.fp ); VIPS_FREE( jpeg->filename ); jpeg->eman.fp = NULL; /* I don't think this can fail. It's harmless to call many times. */ jpeg_destroy_decompress( &jpeg->cinfo ); return( result ); }
static int readjpeg_free( ReadJpeg *jpeg ) { int result; result = 0; if( setjmp( jpeg->eman.jmp ) ) return( -1 ); if( jpeg->eman.pub.num_warnings != 0 ) { if( jpeg->fail ) { vips_error( "VipsJpeg", "%s", vips_error_buffer() ); result = -1; } else { vips_warn( "VipsJpeg", _( "read gave %ld warnings" ), jpeg->eman.pub.num_warnings ); vips_warn( NULL, "%s", vips_error_buffer() ); } /* Make the message only appear once. */ jpeg->eman.pub.num_warnings = 0; } if( jpeg->decompressing ) { jpeg_finish_decompress( &jpeg->cinfo ); jpeg->decompressing = FALSE; } VIPS_FREEF( fclose, jpeg->eman.fp ); VIPS_FREE( jpeg->filename ); jpeg->eman.fp = NULL; jpeg_destroy_decompress( &jpeg->cinfo ); return( result ); }