Skip to content

Commit

Permalink
Update functions.c
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhav412 authored Oct 24, 2023
1 parent 2a1ae03 commit 802907b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions contrib/babelfishpg_tsql/runtime/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ type_id(PG_FUNCTION_ARGS)
char **splitted_object_name;
Oid schema_oid;
Oid user_id = GetUserId();
Oid result = InvalidOid;
Oid result = InvalidOid;
int i;

if (PG_ARGISNULL(0))
Expand All @@ -1760,9 +1760,9 @@ type_id(PG_FUNCTION_ARGS)
/* strip trailing whitespace from input */
i = pg_mbstrlen(input);
while (i > 0 && isspace((unsigned char) input[i - 1]))
i--;
if(i < pg_mbstrlen(input))
input[i] = '\0';
i--;
if(i < pg_mbstrlen(input))
input[i] = '\0';

/* length should be restricted to 4000 */
if (i > TYPE_NAME_MAX_LENGTH)
Expand All @@ -1776,7 +1776,7 @@ type_id(PG_FUNCTION_ARGS)
if(pg_mbstrlen(splitted_object_name[1]) != 0)
{
pfree(input);
for (int i = 0; i < 4; i++)
for (int i = 0; i < 4; i++)
pfree(splitted_object_name[i]);
pfree(splitted_object_name);
PG_RETURN_NULL();
Expand Down

0 comments on commit 802907b

Please sign in to comment.