diff --git a/hll/ACXLoader.c b/hll/ACXLoader.c index 88f4a9a..311527f 100644 --- a/hll/ACXLoader.c +++ b/hll/ACXLoader.c @@ -41,8 +41,10 @@ hll_defun(Load, args) if (!(fp = fopen(path, "rb"))) { WARNING("ACXLoader.Load: Failed to open %s", path); + free(path); hll_return(false); } + free(path); // get size of ACX file fseek(fp, 0, SEEK_END); @@ -67,6 +69,7 @@ hll_defun(Load, args) unsigned long size = acx.size; if (Z_OK != uncompress(acx.data_raw, &size, buf+16, len-16)) { WARNING("ACXLoader.Load: uncompress failed"); + free(buf); hll_return(false); } @@ -74,6 +77,7 @@ hll_defun(Load, args) acx.nr_lines = LittleEndian_getDW(acx.data_raw, 4 + acx.nr_columns * 4); acx.data = acx.data_raw + (8 + acx.nr_columns * 4); + free(buf); hll_return(true); } diff --git a/hll/File.c b/hll/File.c index 878a9e7..ba4ef67 100644 --- a/hll/File.c +++ b/hll/File.c @@ -65,6 +65,8 @@ hll_defun(Close, args) } int r = !fclose(current_file); current_file = NULL; + if (file_contents) + free(file_contents); file_contents = NULL; file_size = 0; file_cursor = 0; @@ -168,8 +170,10 @@ hll_defun(GetTime, args) if (stat(path, &s) < 0) { WARNING("stat failed: %s", strerror(errno)); + free(path); hll_return(0); } + free(path); struct tm *tm = localtime(&s.st_mtime); if (!tm) { diff --git a/text.c b/text.c index eb5080f..26bf266 100644 --- a/text.c +++ b/text.c @@ -333,6 +333,7 @@ void gfx_draw_text_to_amap(Texture *dst, int x, int y, char *text) get_glyph(font->font, &glyph, conv, font_metrics.color); render_glyph(dst, &glyph, pos); gfx_delete_texture(&glyph); + free(conv); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); } @@ -354,6 +355,7 @@ void gfx_draw_text_to_pmap(Texture *dst, int x, int y, char *text) get_glyph(font->font, &glyph, conv, font_metrics.color); render_glyph(dst, &glyph, pos); gfx_delete_texture(&glyph); + free(conv); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); } diff --git a/video.c b/video.c index 2aabd5f..23b926e 100644 --- a/video.c +++ b/video.c @@ -79,6 +79,7 @@ static GLuint load_shader_file(const char *path, GLenum type) glGetShaderiv(shader, GL_COMPILE_STATUS, &shader_compiled); if (!shader_compiled) ERROR("Failed to compile shader: %s", path); + free((char*)source); return shader; }