Skip to content

Commit

Permalink
Merge pull request yugabyte#97 from xrmx/nullfiltertables
Browse files Browse the repository at this point in the history
Avoid null pointer dereference with empty filter-tables
  • Loading branch information
Euler Taveira de Oliveira authored Feb 5, 2019
2 parents be23d7b + de78d00 commit c2712ac
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions wal2json.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,20 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, bool is
elog(DEBUG1, "filter-tables argument is null");
data->filter_tables = NIL;
}

rawstr = pstrdup(strVal(elem->arg));
if (!string_to_SelectTable(rawstr, ',', &data->filter_tables))
else
{

rawstr = pstrdup(strVal(elem->arg));
if (!string_to_SelectTable(rawstr, ',', &data->filter_tables))
{
pfree(rawstr);
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
errmsg("could not parse value \"%s\" for parameter \"%s\"",
strVal(elem->arg), elem->defname)));
}
pfree(rawstr);
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
errmsg("could not parse value \"%s\" for parameter \"%s\"",
strVal(elem->arg), elem->defname)));
}
pfree(rawstr);
}
else if (strcmp(elem->defname, "add-tables") == 0)
{
Expand Down

0 comments on commit c2712ac

Please sign in to comment.