mirror of
https://github.com/postgres/postgres.git
synced 2026-04-20 22:00:13 -04:00
Fix memory leak in new GUC check_hook
Commit 38e0190ced forgot to pfree() an allocation (freed in other
places of the same function) in only one of several spots in
check_log_min_messages(). Per Coverity. Add that.
While at it, avoid open-coding guc_strdup(). The new coding does a
strlen() that wasn't there before, but I doubt it's measurable.
This commit is contained in:
parent
a92b809f9d
commit
661237056b
1 changed files with 4 additions and 3 deletions
|
|
@ -2363,11 +2363,12 @@ lmm_fail:
|
|||
appendStringInfo(&buf, ", %s", elem);
|
||||
}
|
||||
|
||||
result = (char *) guc_malloc(LOG, buf.len + 1);
|
||||
result = guc_strdup(LOG, buf.data);
|
||||
if (!result)
|
||||
{
|
||||
pfree(buf.data);
|
||||
return false;
|
||||
memcpy(result, buf.data, buf.len);
|
||||
result[buf.len] = '\0';
|
||||
}
|
||||
|
||||
guc_free(*newval);
|
||||
*newval = result;
|
||||
|
|
|
|||
Loading…
Reference in a new issue