Correct some memory leaks found by MSVC

This commit is contained in:
hooper114 2009-06-18 10:20:23 +00:00
parent 6c631bf282
commit 18b986156f
10 changed files with 60 additions and 35 deletions

View file

@ -23,7 +23,7 @@
#include <string.h>
#include <stdlib.h>
#ifdef _MSC_VER
#include <malloc.h>
#include <malloc.h>
#endif
#include "common.h"
#include "aztec.h"
@ -55,14 +55,14 @@ int aztec_text_process(unsigned char source[], char binary_string[], int gs1)
int i, j, k, bytes;
int curtable, newtable, lasttable, chartype, maplength, blocks, debug;
#ifndef _MSC_VER
int charmap[ustrlen(source)], typemap[ustrlen(source)];
int charmap[ustrlen(source) * 2], typemap[ustrlen(source) * 2];
int blockmap[2][ustrlen(source)];
#else
int* charmap = (int*)_alloca(ustrlen(source) * sizeof(int));
int* typemap = (int*)_alloca(ustrlen(source) * sizeof(int));
int* charmap = (int*)_alloca((ustrlen(source) * 2) * sizeof(int));
int* typemap = (int*)_alloca((ustrlen(source) * 2) * sizeof(int));
int* blockmap[2];
blockmap[0] = (int*)_alloca(ustrlen(source) * sizeof(int));
blockmap[1] = (int*)_alloca(ustrlen(source) * sizeof(int));
blockmap[0] = (int*)_alloca(ustrlen(source) * sizeof(int));
blockmap[1] = (int*)_alloca(ustrlen(source) * sizeof(int));
#endif
/* Lookup input string in encoding table */
maplength = 0;