The attached tiny patch fixes a small leak in psql's \gset command and
simplifies memory freeing in two places.
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
new file mode 100644
index 764534a..e80528d
*** a/src/bin/psql/command.c
--- b/src/bin/psql/command.c
*************** exec_command(const char *cmd,
*** 746,753 ****
{
expand_tilde(&fname);
pset.gfname = pg_strdup(fname);
}
- free(fname);
status = PSQL_CMD_SEND;
}
--- 746,753 ----
{
expand_tilde(&fname);
pset.gfname = pg_strdup(fname);
+ free(fname);
}
status = PSQL_CMD_SEND;
}
*************** exec_command(const char *cmd,
*** 757,762 ****
--- 757,764 ----
char *prefix = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, false);
+ if (pset.gset_prefix)
+ free(pset.gset_prefix);
if (prefix)
pset.gset_prefix = prefix;
else
*************** exec_command(const char *cmd,
*** 1152,1159 ****
success = false;
}
free(newval);
}
- free(opt0);
}
--- 1154,1161 ----
success = false;
}
free(newval);
+ free(opt0);
}
}
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers