mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
stbi: fix memory leak from stbi.load/1
with GC (#16028)
This commit is contained in:
17
thirdparty/stb_image/stbi.c
vendored
17
thirdparty/stb_image/stbi.c
vendored
@ -1,5 +1,19 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
extern void * stbi__callback_malloc(size_t size);
|
||||
extern void * stbi__callback_realloc(void *ptr, size_t size);
|
||||
extern void stbi__callback_free(void *ptr);
|
||||
|
||||
#define STBI_MALLOC(sz) stbi__callback_malloc(sz)
|
||||
#define STBI_REALLOC(p,newsz) stbi__callback_realloc(p,newsz)
|
||||
#define STBI_FREE(p) stbi__callback_free(p)
|
||||
#define STBIW_MALLOC(sz) stbi__callback_malloc(sz)
|
||||
#define STBIW_REALLOC(p,newsz) stbi__callback_realloc(p,newsz)
|
||||
#define STBIW_FREE(p) stbi__callback_free(p)
|
||||
|
||||
#include "stb_image.h"
|
||||
#include "stb_image_write.h"
|
||||
|
||||
@ -19,4 +33,5 @@ void write_force_png_filter(int level){
|
||||
|
||||
void write_tga_with_rle(int level) {
|
||||
stbi_write_tga_with_rle = level;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user