X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser.re;h=ebd1e1628de46248bf97d3cafe3589a189786d4f;hp=ab3cdada2bc161c6a6e78a3a5ea34831d2b69aa0;hb=35060621f2fd5079502543d17942127c1a602f72;hpb=c0873cbbe9e5a83305adbc2bbd94aede5437f33d diff --git a/src/parser.re b/src/parser.re index ab3cdad..ebd1e16 100644 --- a/src/parser.re +++ b/src/parser.re @@ -41,7 +41,7 @@ struct psi_parser *psi_parser_init(struct psi_parser *P, psi_error_cb error, unsigned flags) { if (!P) { - P = malloc(sizeof(*P)); + P = pemalloc(sizeof(*P), 1); } memset(P, 0, sizeof(*P)); @@ -67,7 +67,7 @@ struct psi_parser_input *psi_parser_open_file(struct psi_parser *P, const char * return NULL; } - if (!(fb = malloc(sizeof(*fb) + sb.st_size + YYMAXFILL))) { + if (!(fb = pemalloc(sizeof(*fb) + sb.st_size + YYMAXFILL, 1))) { if (report_errors) { P->error(PSI_DATA(P), NULL, PSI_WARNING, "Could not allocate %zu bytes for reading '%s': %s", @@ -107,7 +107,7 @@ struct psi_parser_input *psi_parser_open_string(struct psi_parser *P, const char { struct psi_parser_input *sb; - if (!(sb = malloc(sizeof(*sb) + length + YYMAXFILL))) { + if (!(sb = pemalloc(sizeof(*sb) + length + YYMAXFILL, 1))) { P->error(PSI_DATA(P), NULL, PSI_WARNING, "Could not allocate %zu bytes: %s", length + YYMAXFILL, strerror(errno));