mirror of https://github.com/citusdata/citus.git
Replace more spurious strdups with pstrdups (#7441)
DESCRIPTION: Remove a few small memory leaks In #7440 one instance of a strdup was removed. But there were a few more. This removes the ones that are left over, or adds a comment why strdup is on purpose.pull/7444/head
parent
72fbea20c4
commit
9683bef2ec
|
@ -776,7 +776,7 @@ PreprocessCreateExtensionStmtForCitusColumnar(Node *parsetree)
|
||||||
/*create extension citus version xxx*/
|
/*create extension citus version xxx*/
|
||||||
if (newVersionValue)
|
if (newVersionValue)
|
||||||
{
|
{
|
||||||
char *newVersion = strdup(defGetString(newVersionValue));
|
char *newVersion = pstrdup(defGetString(newVersionValue));
|
||||||
versionNumber = GetExtensionVersionNumber(newVersion);
|
versionNumber = GetExtensionVersionNumber(newVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -796,7 +796,7 @@ PreprocessCreateExtensionStmtForCitusColumnar(Node *parsetree)
|
||||||
Oid citusOid = get_extension_oid("citus", true);
|
Oid citusOid = get_extension_oid("citus", true);
|
||||||
if (citusOid != InvalidOid)
|
if (citusOid != InvalidOid)
|
||||||
{
|
{
|
||||||
char *curCitusVersion = strdup(get_extension_version(citusOid));
|
char *curCitusVersion = pstrdup(get_extension_version(citusOid));
|
||||||
int curCitusVersionNum = GetExtensionVersionNumber(curCitusVersion);
|
int curCitusVersionNum = GetExtensionVersionNumber(curCitusVersion);
|
||||||
if (curCitusVersionNum < 1110)
|
if (curCitusVersionNum < 1110)
|
||||||
{
|
{
|
||||||
|
@ -891,7 +891,7 @@ PreprocessAlterExtensionCitusStmtForCitusColumnar(Node *parseTree)
|
||||||
if (newVersionValue)
|
if (newVersionValue)
|
||||||
{
|
{
|
||||||
char *newVersion = defGetString(newVersionValue);
|
char *newVersion = defGetString(newVersionValue);
|
||||||
double newVersionNumber = GetExtensionVersionNumber(strdup(newVersion));
|
double newVersionNumber = GetExtensionVersionNumber(pstrdup(newVersion));
|
||||||
|
|
||||||
/*alter extension citus update to version >= 11.1-1, and no citus_columnar installed */
|
/*alter extension citus update to version >= 11.1-1, and no citus_columnar installed */
|
||||||
if (newVersionNumber >= 1110 && citusColumnarOid == InvalidOid)
|
if (newVersionNumber >= 1110 && citusColumnarOid == InvalidOid)
|
||||||
|
@ -935,7 +935,7 @@ PostprocessAlterExtensionCitusStmtForCitusColumnar(Node *parseTree)
|
||||||
if (newVersionValue)
|
if (newVersionValue)
|
||||||
{
|
{
|
||||||
char *newVersion = defGetString(newVersionValue);
|
char *newVersion = defGetString(newVersionValue);
|
||||||
double newVersionNumber = GetExtensionVersionNumber(strdup(newVersion));
|
double newVersionNumber = GetExtensionVersionNumber(pstrdup(newVersion));
|
||||||
if (newVersionNumber >= 1110 && citusColumnarOid != InvalidOid)
|
if (newVersionNumber >= 1110 && citusColumnarOid != InvalidOid)
|
||||||
{
|
{
|
||||||
/*upgrade citus, after "ALTER EXTENSION citus update to xxx" updates citus_columnar Y to version Z. */
|
/*upgrade citus, after "ALTER EXTENSION citus update to xxx" updates citus_columnar Y to version Z. */
|
||||||
|
|
|
@ -123,6 +123,10 @@ AddConnParam(const char *keyword, const char *value)
|
||||||
errmsg("ConnParams arrays bound check failed")));
|
errmsg("ConnParams arrays bound check failed")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Don't use pstrdup here to avoid being tied to a memory context, we free
|
||||||
|
* these later using ResetConnParams
|
||||||
|
*/
|
||||||
ConnParams.keywords[ConnParams.size] = strdup(keyword);
|
ConnParams.keywords[ConnParams.size] = strdup(keyword);
|
||||||
ConnParams.values[ConnParams.size] = strdup(value);
|
ConnParams.values[ConnParams.size] = strdup(value);
|
||||||
ConnParams.size++;
|
ConnParams.size++;
|
||||||
|
|
|
@ -449,7 +449,7 @@ CreateTargetEntryForNullCol(Form_pg_attribute attributeTuple, int resno)
|
||||||
attributeTuple->attcollation);
|
attributeTuple->attcollation);
|
||||||
char *resName = attributeTuple->attname.data;
|
char *resName = attributeTuple->attname.data;
|
||||||
TargetEntry *targetEntry =
|
TargetEntry *targetEntry =
|
||||||
makeTargetEntry(nullExpr, resno, strdup(resName), false);
|
makeTargetEntry(nullExpr, resno, pstrdup(resName), false);
|
||||||
return targetEntry;
|
return targetEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue