Skip to content

Commit f1976df

Browse files
committed
Remove fe_memutils from libpgcommon_shlib
libpq must not use palloc/pfree. It's not allowed to exit on allocation failure, and mixing the frontend pfree with malloc is architecturally unsound. Remove fe_memutils from the shlib build entirely, to keep devs from accidentally depending on it in the future. Author: Jacob Champion <jacob.champion@enterprisedb.com> Discussion: https://www.postgresql.org/message-id/CAOYmi+=pg=W5L1h=3MEP_EB24jaBu2FyATrLXqQHGe7cpuvwyg@mail.gmail.com
1 parent 94980c4 commit f1976df

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/common/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,15 @@ endif
102102
# A few files are currently only built for frontend, not server.
103103
# logging.c is excluded from OBJS_FRONTEND_SHLIB (shared library) as
104104
# a matter of policy, because it is not appropriate for general purpose
105-
# libraries such as libpq to report errors directly.
105+
# libraries such as libpq to report errors directly. fe_memutils.c is
106+
# excluded because libpq must not exit() on allocation failure.
106107
OBJS_FRONTEND_SHLIB = \
107108
$(OBJS_COMMON) \
108-
fe_memutils.o \
109109
restricted_token.o \
110110
sprompt.o
111111
OBJS_FRONTEND = \
112112
$(OBJS_FRONTEND_SHLIB) \
113+
fe_memutils.o \
113114
logging.o
114115

115116
# foo.o, foo_shlib.o, and foo_srv.o are all built from foo.c

src/common/meson.build

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,18 @@ common_sources_cflags = {
101101
# A few files are currently only built for frontend, not server.
102102
# logging.c is excluded from OBJS_FRONTEND_SHLIB (shared library) as
103103
# a matter of policy, because it is not appropriate for general purpose
104-
# libraries such as libpq to report errors directly.
104+
# libraries such as libpq to report errors directly. fe_memutils.c is
105+
# excluded because libpq must not exit() on allocation failure.
105106

106107
common_sources_frontend_shlib = common_sources
107108
common_sources_frontend_shlib += files(
108-
'fe_memutils.c',
109109
'restricted_token.c',
110110
'sprompt.c',
111111
)
112112

113113
common_sources_frontend_static = common_sources_frontend_shlib
114114
common_sources_frontend_static += files(
115+
'fe_memutils.c',
115116
'logging.c',
116117
)
117118

0 commit comments

Comments
 (0)