From: Michael Tremer Date: Sun, 14 Feb 2021 16:25:28 +0000 (+0000) Subject: parser: Do not use pakfire's own memory allocation functions any more X-Git-Tag: 0.9.28~1285^2~725 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=760dd6e68b5c9bb15d35ceeda5c3889a6dabd8a3;p=pakfire.git parser: Do not use pakfire's own memory allocation functions any more Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/parser/scanner.l b/src/libpakfire/parser/scanner.l index 1a7aac769..d6d973d4f 100644 --- a/src/libpakfire/parser/scanner.l +++ b/src/libpakfire/parser/scanner.l @@ -45,7 +45,10 @@ static char* find_name(const char* s, const char* prefix) { size_t length = strlen(prefix) + strlen(name); // Allocate a new buffer and write the string into it - char* buffer = pakfire_malloc(length + 1); + char* buffer = malloc(length + 1); + if (!buffer) + abort(); + snprintf(buffer, length + 1, "%s%s", prefix, name); return buffer; @@ -134,7 +137,10 @@ template2 {whitespace}template.* size_t length = strlen("define ") + yyleng; // Make a copy because unput touches yytext - char* buffer = pakfire_malloc(length + 1); + char* buffer = malloc(length + 1); + if (!buffer) + abort(); + snprintf(buffer, length + 1, "define %s", yytext); // Put the whole string back onto the stack (backwards) @@ -174,12 +180,12 @@ template2 {whitespace}template.* size_t len = strlen(yytext); yytext[len-1] = '\0'; - yylval.string = pakfire_strdup(yytext + 1); + yylval.string = strdup(yytext + 1); return T_WORD; } {word} { - yylval.string = pakfire_strdup(yytext); + yylval.string = strdup(yytext); return T_WORD; }