Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit43568d1

Browse files
committed
Fix memory leakage when sending notice messages to client.
1 parentaed378e commit43568d1

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

‎src/backend/utils/error/elog.c

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.88 2001/08/06 21:55:13 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.89 2001/10/18 23:07:29 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -63,11 +63,13 @@ boolLog_pid;
6363

6464
staticconstchar*print_timestamp(void);
6565
staticconstchar*print_pid(void);
66-
staticvoidsend_notice_to_frontend(constchar*msg);
67-
staticvoidsend_error_to_frontend(constchar*msg);
66+
staticvoidsend_message_to_frontend(inttype,constchar*msg);
6867
staticconstchar*useful_strerror(interrnum);
6968
staticconstchar*elog_message_prefix(intlev);
7069

70+
#definesend_notice_to_frontend(msg) send_message_to_frontend(NOTICE, msg)
71+
#definesend_error_to_frontend(msg) send_message_to_frontend(ERROR, msg)
72+
7173

7274
staticintDebugfile=-1;
7375

@@ -667,40 +669,18 @@ write_syslog(int level, const char *line)
667669
#endif/* ENABLE_SYSLOG */
668670

669671

670-
671-
staticvoid
672-
send_notice_or_error_to_frontend(inttype,constchar*msg);
673-
674-
675-
staticvoid
676-
send_notice_to_frontend(constchar*msg)
677-
{
678-
send_notice_or_error_to_frontend(NOTICE,msg);
679-
}
680-
681-
682-
staticvoid
683-
send_error_to_frontend(constchar*msg)
684-
{
685-
send_notice_or_error_to_frontend(ERROR,msg);
686-
}
687-
688-
689672
staticvoid
690-
send_notice_or_error_to_frontend(inttype,constchar*msg)
673+
send_message_to_frontend(inttype,constchar*msg)
691674
{
692-
StringInfobuf;
675+
StringInfoDatabuf;
693676

694677
AssertArg(type==NOTICE||type==ERROR);
695678

696-
buf=makeStringInfo();
697-
698-
pq_beginmessage(buf);
699-
pq_sendbyte(buf,type==NOTICE ?'N' :'E');
700-
pq_sendstring(buf,msg);
701-
pq_endmessage(buf);
679+
pq_beginmessage(&buf);
680+
pq_sendbyte(&buf,type==NOTICE ?'N' :'E');
681+
pq_sendstring(&buf,msg);
682+
pq_endmessage(&buf);
702683

703-
pfree(buf);
704684
/*
705685
* This flush is normally not necessary, since postgres.c will
706686
* flush out waiting data when control returns to the main loop.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp