Removing memory leaks.
This commit is contained in:
parent
a10e282eb4
commit
0b48fb8bd7
5
Makefile
5
Makefile
|
@ -12,10 +12,15 @@ CFLAGS = -march=native -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/s
|
|||
ifeq ($(SANITIZE),1)
|
||||
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||
CFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||
else
|
||||
ifeq ($(DEBUG),1)
|
||||
CXXFLAGS += -g3 -O0
|
||||
CFLAGS += -g3 -O0
|
||||
else
|
||||
CXXFLAGS += -O3
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
endif
|
||||
|
||||
MAINEXECUTABLES=parse minify json2json
|
||||
TESTEXECUTABLES=jsoncheck numberparsingcheck stringparsingcheck
|
||||
|
|
|
@ -78,7 +78,7 @@ int main(int argc, char *argv[]) {
|
|||
std::cout << p.size() << " B ";
|
||||
std::cout << std::endl;
|
||||
}
|
||||
char *buffer = allocate_aligned_buffer(p.size() + 1);
|
||||
char *buffer = allocate_padded_buffer(p.size() + 1);
|
||||
memcpy(buffer, p.data(), p.size());
|
||||
buffer[p.size()] = '\0';
|
||||
|
||||
|
@ -111,7 +111,7 @@ int main(int argc, char *argv[]) {
|
|||
BEST_TIME("RapidJSON Insitu orig", d.ParseInsitu(buffer).HasParseError(), false,
|
||||
memcpy(buffer, p.data(), p.size()), repeat, volume, true);
|
||||
|
||||
char *minibuffer = allocate_aligned_buffer(p.size() + 1);
|
||||
char *minibuffer = allocate_padded_buffer(p.size() + 1);
|
||||
size_t minisize = jsonminify((const uint8_t *)p.data(), p.size(), (uint8_t*) minibuffer);
|
||||
minibuffer[minisize] = '\0';
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ bool validate(const char *dirname) {
|
|||
float_count, invalid_count,
|
||||
int_count + float_count + invalid_count);
|
||||
}
|
||||
free(p.data());
|
||||
free((void*)p.data());
|
||||
free(fullpath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ int main(int argc, char *argv[]) {
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
bool is_ok = json_parse(p, pj); // do the parsing, return false on error
|
||||
free((void*)p.data());
|
||||
if (!is_ok) {
|
||||
std::cerr << " Parsing failed. " << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -18,4 +18,5 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
jsonminify(p, (char *)p.data());
|
||||
printf("%s",p.data());
|
||||
free((void*)p.data());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue