Skip to content

Commit 6e3888d

Browse files
committed
[parser] Fix crash on some platforms when using user-defined functions.
1 parent a065f44 commit 6e3888d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

source/parser/parser_functions_utilities.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/// @parblock
1212
///
1313
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
14-
/// Copyright 1991-2018 Persistence of Vision Raytracer Pty. Ltd.
14+
/// Copyright 1991-2019 Persistence of Vision Raytracer Pty. Ltd.
1515
///
1616
/// POV-Ray is free software: you can redistribute it and/or modify
1717
/// it under the terms of the GNU Affero General Public License as
@@ -84,7 +84,7 @@ using namespace pov;
8484

8585
FUNCTION_PTR Parser::Parse_Function(void)
8686
{
87-
FUNCTION_PTR ptr = (FUNCTION_PTR)POV_MALLOC(sizeof(FUNCTION), "Function ID");
87+
FUNCTION_PTR ptr = new FUNCTION;
8888
ExprNode *expression = nullptr;
8989
FunctionCode function;
9090

@@ -134,7 +134,7 @@ FUNCTION_PTR Parser::Parse_Function(void)
134134

135135
FUNCTION_PTR Parser::Parse_FunctionContent(void)
136136
{
137-
FUNCTION_PTR ptr = (FUNCTION_PTR)POV_MALLOC(sizeof(FUNCTION), "Function ID");
137+
FUNCTION_PTR ptr = new FUNCTION;
138138
ExprNode *expression = nullptr;
139139
FunctionCode function;
140140

@@ -212,7 +212,7 @@ void Parser::Parse_FunctionOrContentList(GenericScalarFunctionPtr* apFn, unsigne
212212

213213
FUNCTION_PTR Parser::Parse_DeclareFunction(TokenId *token_id, const char *fn_name, bool is_local)
214214
{
215-
FUNCTION_PTR ptr = (FUNCTION_PTR)POV_MALLOC(sizeof(FUNCTION), "Function ID");
215+
FUNCTION_PTR ptr = new FUNCTION;
216216
ExprNode *expression = nullptr;
217217
FunctionCode function;
218218

0 commit comments

Comments
 (0)