Skip to content

Commit

Permalink
dsl: raise ES_ERROR_MEMORY when malloc returns NULL
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Oct 26, 2024
1 parent 2561923 commit 0f78038
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dsl/dsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,8 @@ static EsObject* caseop (EsObject *o, int (*op)(int))
{
const char *s = es_string_get (o);
char *r = strdup (s);
if (r == NULL)
return ES_ERROR_MEMORY;

for (char *tmp = r; *tmp != '\0'; tmp++)
*tmp = op ((unsigned char) *tmp);
Expand Down

0 comments on commit 0f78038

Please sign in to comment.