mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-15 10:11:29 +08:00
Fix static analyzer warning when checking for index attributes
This fixes a static analyzer warning about using an unititalized pointer. The analyzer doesn't realize that elog() will generate an exception, so that the unitialized NULL check will never occur. This change will clarify the code and silence the static analyzer.
This commit is contained in:
parent
7d9f49b4c0
commit
12bc1175f8
@ -23,7 +23,7 @@ index_has_attribute(List *indexelems, const char *attrname)
|
||||
foreach(lc, indexelems)
|
||||
{
|
||||
Node *node = lfirst(lc);
|
||||
const char *colname;
|
||||
const char *colname = NULL;
|
||||
|
||||
/*
|
||||
* The type of the element varies depending on whether the list is
|
||||
@ -53,7 +53,7 @@ index_has_attribute(List *indexelems, const char *attrname)
|
||||
elog(ERROR, "unsupported index list element");
|
||||
}
|
||||
|
||||
if (strncmp(colname, attrname, NAMEDATALEN) == 0)
|
||||
if (colname != NULL && strncmp(colname, attrname, NAMEDATALEN) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user