8000 Fix ancient memory leak in PQprintTuples(); our code no longer uses this · postgres/postgres@8f52496 · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"commit":{"oid":"8f52496a05e83666bcf8b32c6e525cc6730fd78b","url":"/postgres/postgres/commit/8f52496a05e83666bcf8b32c6e525cc6730fd78b","authoredDate":"2006-04-19T16:15:29.000Z","committedDate":"2006-04-19T16:15:29.000Z","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eFix ancient memory leak in PQprintTuples(); our code no longer uses this\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"routine, but perhaps some applications do. Found by Martijn van Oosterhout\nusing Coverity.","authors":[{"login":"tglsfdc","displayName":"Tom Lane","avatarUrl":"https://avatars.githubusercontent.com/u/8755309?v=4","path":"/tglsfdc","isGitHub":false}],"committerAttribution":false,"committer":{"login":"tglsfdc","displayName":"Tom Lane","avatarUrl":"https://avatars.githubusercontent.com/u/8755309?v=4","path":"/tglsfdc","isGitHub":false},"pusher":null,"pushedDate":null,"parents":["3224f2ee250cf5b53dc201d850b03d1e319f1782"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOjhmNTI0OTZhMDVlODM2NjZiY2Y4YjMyYzZlNTI1Y2M2NzMwZmQ3OGI=","sha1":"3224f2ee250cf5b53dc201d850b03d1e319f1782","sha2":"8f52496a05e83666bcf8b32c6e525cc6730fd78b"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":9,"text":"@@ -10,7 +10,7 @@","html":"@@ -10,7 +10,7 @@","displayNoNewLineWarning":false,"position":0,"left":9,"right":9},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":10,"text":" * didn't really belong there.","html":" \u003cspan class=pl-c\u003e * didn\u0026#39;t really belong there.\u003c/span\u003e","displayNoNewLineWarning":false,"position":1,"left":10,"right":10},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":11,"text":" *","html":" \u003cspan class=pl-c\u003e *\u003c/span\u003e","displayNoNewLineWarning":false,"position":2,"left":11,"right":11},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":12,"text":" * IDENTIFICATION","html":" \u003cspan class=pl-c\u003e * IDENTIFICATION\u003c/span\u003e","displayNoNewLineWarning":false,"position":3,"left":12,"right":12},{"stylingDirective":null,"type":"DELETION","blobLineNumber":13,"text":"- *\t $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.67 2006/03/05 15:59:09 momjian Exp $","html":"-\u003cspan class=\"pl-c\"\u003e *\t $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.\u003cspan class=\"x x-first x-last\"\u003e67\u003c/span\u003e 2006/\u003cspan class=\"x x-first x-last\"\u003e03/05 \u003c/span\u003e15:\u003cspan class=\"x x-first x-last\"\u003e59:09 momjian\u003c/span\u003e Exp $\u003c/span\u003e","displayNoNewLineWarning":false,"position":4,"left":13,"right":12},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":13,"text":"+ *\t $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.68 2006/04/19 16:15:29 tgl Exp $","html":"+\u003cspan class=\"pl-c\"\u003e *\t $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.\u003cspan class=\"x x-first x-last\"\u003e68\u003c/span\u003e 2006/\u003cspan class=\"x x-first x-last\"\u003e04/19 16:\u003c/span\u003e15:\u003cspan class=\"x x-first x-last\"\u003e29 tgl\u003c/span\u003e Exp $\u003c/span\u003e","displayNoNewLineWarning":false,"position":5,"left":13,"right":13},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":14,"text":" *","html":" \u003cspan class=pl-c\u003e *\u003c/span\u003e","displayNoNewLineWarning":false,"position":6,"left":14,"right":14},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":15,"text":" *-------------------------------------------------------------------------","html":" \u003cspan class=pl-c\u003e *-------------------------------------------------------------------------\u003c/span\u003e","displayNoNewLineWarning":false,"position":7,"left":15,"right":15},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":16,"text":" */","html":" \u003cspan class=pl-c\u003e */\u003c/span\u003e","displayNoNewLineWarning":false,"position":8,"left":16,"right":16},{"stylingDirective":null,"type":"HUNK","blobLineNumber":750,"text":"@@ -751,8 +751,10 @@ PQprintTuples(const PGresult *res,","html":"@@ -751,8 +751,10 @@ PQprintTuples(const PGresult *res,","displayNoNewLineWarning":false,"position":9,"left":750,"right":750},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":751,"text":" \t\t\t\tfprintf(fout, \"|\\n%s\\n\", tborder);","html":" \t\t\t\t\u003cspan class=pl-en\u003efprintf\u003c/span\u003e(\u003cspan class=pl-s1\u003efout\u003c/span\u003e, \u003cspan class=pl-s\u003e\u0026quot;|\\n%s\\n\u0026quot;\u003c/span\u003e, \u003cspan class=pl-s1\u003etborder\u003c/span\u003e);","displayNoNewLineWarning":false,"position":10,"left":751,"right":751},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":752,"text":" \t\t}","html":" \t\t}","displayNoNewLineWarning":false,"position":11,"left":752,"right":752},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":753,"text":" \t}","html":" \t}","displayNoNewLineWarning":false,"position":12,"left":753,"right":753},{"stylingDirective":null,"type":"DELETION","blobLineNumber":754,"text":"-}","html":"-}","displayNoNewLineWarning":false,"position":13,"left":754,"right":753},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":754,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":14,"left":755,"right":754},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":755,"text":"+\tif (tborder)","html":"+\t\u003cspan class=pl-k\u003eif\u003c/span\u003e (\u003cspan class=pl-s1\u003etborder\u003c/span\u003e)","displayNoNewLineWarning":false,"position":15,"left":755,"right":755},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":756,"text":"+\t\tfree(tborder);","html":"+\t\t\u003cspan class=pl-en\u003efree\u003c/span\u003e(\u003cspan class=pl-s1\u003etborder\u003c/span\u003e);","displayNoNewLineWarning":false,"position":16,"left":755,"right":756},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":757,"text":"+}","html":"+}","displayNoNewLineWarning":false,"position":17,"left":755,"right":757},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":758,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":18,"left":756,"right":758},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":759,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":19,"left":757,"right":759},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":760,"text":" /* simply send out max-length number of filler characters to fp */","html":" \u003cspan class=pl-c\u003e/* simply send out max-length number of filler characters to fp */\u003c/span\u003e","displayNoNewLineWarning":false,"position":20,"left":758,"right":760}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":770,"linesChanged":6,"newTreeEntry":{"lineCount":770,"path":"src/interfaces/libpq/fe-print.c","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"src/interfaces/libpq/fe-print.c","mode":100644},"linesAdded":4,"linesDeleted":2,"path":"src/interfaces/libpq/fe-print.c","pathDigest":"7bd5043492507c008a0c8257bc10fbae6c1faf92ba8be50d3dd0876b2721777a","status":"MODIFIED","truncatedReason":null,"oldOid":"3224f2ee250cf5b53dc201d850b03d1e319f1782","newOid":"8f52496a05e83666bcf8b32c6e525cc6730fd78b","copilotChatReference":null,"deletedSha":"3224f2ee250cf5b53dc201d850b03d1e319f1782","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/8f52496a05e83666bcf8b32c6e525cc6730fd78b","fileTreeExpanded":true,"headerInfo":{"additions":4,"deletions":2,"filesChanged":1,"filesChangedString":"1"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":1,"truncated":false,"byteCount":568,"lineShownCount":21},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"6SFKewGAj6KtrMv4NtapSal7ctAfu-bBqFu7N8DmTsxKZy1dA1fBsGEZXJkHdJfiFimc7i6rnJToICG3wcmAsw"},"/users/diffview?diff=unified":{"post":"jhSlMlh4JfNUR8Tw48fN9OsZPb45n034wnrWl4QPtoQtUsIUWq9r4ZjyU5HSZfNfVEvTgAiPN62CAUwXhSB4-w"},"/notifications/thread":{"post":"jotONaylnoDRqDST4JtlN7N5DqdKueqP0UgaYk7SQmVYP27EAtfSXrkkvXbyLXju5KZ17DnVDpkpuaBLsNJsrw"}}},"title":"Fix ancient memory leak in PQprintTuples(); our code no longer uses this · postgres/postgres@8f52496","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"show_pusher_on_commit_detail":false}}}

Commit 8f52496

Browse files
committed
Fix ancient memory leak in PQprintTuples(); our code no longer uses this
routine, but perhaps some applications do. Found by Martijn van Oosterhout using Coverity.
1 parent 3224f2e commit 8f52496

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/interfaces/libpq/fe-print.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* didn't really belong there.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.67 2006/03/05 15:59:09 momjian Exp $
13+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.68 2006/04/19 16:15:29 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -751,8 +751,10 @@ PQprintTuples(const PGresult *res,
751751
fprintf(fout, "|\n%s\n", tborder);
752752
}
753753
}
754-
}
755754

755+
if (tborder)
756+
free(tborder);
757+
}
756758

757759

758760
/* simply send out max-length number of filler characters to fp */

0 commit comments

Comments
 (0)
0