forked from ExternalVendorCode/Signal-Server
Add image_free to tidy-up
This commit is contained in:
6
image.cc
6
image.cc
@@ -106,7 +106,7 @@ int image_init(PIMAGE_CTX ctx, \
|
||||
return success;
|
||||
}
|
||||
/*
|
||||
* image_add_pixel, image_set_pixel, image_get_pixel, image_write
|
||||
* image_add_pixel, image_set_pixel, image_get_pixel, image_write, image_free
|
||||
* Various setters ad getters for assigning pixel data. image_write
|
||||
* takes an open file handle and writes image data to it.
|
||||
* These functions simply wrap the underlying format-specific functions
|
||||
@@ -134,6 +134,10 @@ int image_write(PIMAGE_CTX ctx, FILE *fd){
|
||||
if(ctx->initialized != 1) return EINVAL;
|
||||
return dt->write(ctx,fd);
|
||||
}
|
||||
void image_free(PIMAGE_CTX ctx){
|
||||
if(ctx->initialized != 1) return;
|
||||
free(ctx->canvas);
|
||||
}
|
||||
|
||||
/*
|
||||
* image_get_filename
|
||||
|
1
image.hh
1
image.hh
@@ -36,6 +36,7 @@ int image_set_pixel(PIMAGE_CTX ctx, const size_t, const size_t, const uint8_t, c
|
||||
int image_get_pixel(PIMAGE_CTX ctx,const size_t,const size_t, uint8_t const*, uint8_t const*, uint8_t const*, uint8_t const*);
|
||||
int image_get_filename(PIMAGE_CTX, char*, size_t, char*);
|
||||
int image_write(PIMAGE_CTX, FILE*);
|
||||
void image_free(PIMAGE_CTX);
|
||||
int image_set_library(char*);
|
||||
|
||||
#define ADD_PIXEL(ctx,r,g,b) image_add_pixel((ctx),(r),(g),(b),0xff)
|
||||
|
@@ -749,6 +749,8 @@ void DoRxdPwr(char *filename, unsigned char geo, unsigned char kml,
|
||||
|
||||
fflush(fd);
|
||||
|
||||
image_free(&ctx);
|
||||
|
||||
if( filename != NULL ) {
|
||||
fclose(fd);
|
||||
fd = NULL;
|
||||
|
Reference in New Issue
Block a user