Skip to content

Commit

Permalink
bugfix: license_query() may crash if license is not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
kaigai committed Mar 14, 2023
1 parent 69fa791 commit 374b150
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions next/extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ pgstrom_license_query(PG_FUNCTION_ARGS)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("only superuser can query commercial license"))));
license = __heterodb_license_query();
if (!license)
PG_RETURN_NULL();

PG_RETURN_POINTER(DirectFunctionCall1(json_in, PointerGetDatum(license)));
}
Expand Down
2 changes: 2 additions & 0 deletions src/extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ pgstrom_license_query(PG_FUNCTION_ARGS)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("only superuser can query commercial license"))));
license = __heterodb_license_query();
if (!license)
PG_RETURN_NULL();

PG_RETURN_POINTER(DirectFunctionCall1(json_in, PointerGetDatum(license)));
}
Expand Down

0 comments on commit 374b150

Please sign in to comment.