Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
b84788de
Commit
b84788de
authored
Sep 22, 2004
by
Neil Conway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor cleanup of libpq/LO examples: fix some memory leaks, update a comment
or two.
parent
a94edb4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
src/test/examples/testlibpq.c
src/test/examples/testlibpq.c
+1
-1
src/test/examples/testlibpq4.c
src/test/examples/testlibpq4.c
+7
-7
src/test/examples/testlo.c
src/test/examples/testlo.c
+3
-1
No files found.
src/test/examples/testlibpq.c
View file @
b84788de
/*
/*
* testlibpq.c
* testlibpq.c
*
*
* Test the C version of
LIBPQ, the POSTGRES
frontend library.
* Test the C version of
libpq, the PostgreSQL
frontend library.
*/
*/
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
...
src/test/examples/testlibpq4.c
View file @
b84788de
...
@@ -92,8 +92,8 @@ main(int argc, char **argv)
...
@@ -92,8 +92,8 @@ main(int argc, char **argv)
}
}
/*
/*
*
should PQclear PGresult whenever it is no longer needed to avoid
*
make sure to PQclear() a PGresult whenever it is no longer
* memory leaks
*
needed to avoid
memory leaks
*/
*/
PQclear
(
res1
);
PQclear
(
res1
);
...
@@ -106,7 +106,7 @@ main(int argc, char **argv)
...
@@ -106,7 +106,7 @@ main(int argc, char **argv)
{
{
fprintf
(
stderr
,
"DECLARE CURSOR command failed
\n
"
);
fprintf
(
stderr
,
"DECLARE CURSOR command failed
\n
"
);
PQclear
(
res1
);
PQclear
(
res1
);
exit_nicely
(
conn1
,
NULL
);
exit_nicely
(
conn1
,
conn2
);
}
}
PQclear
(
res1
);
PQclear
(
res1
);
...
@@ -115,7 +115,7 @@ main(int argc, char **argv)
...
@@ -115,7 +115,7 @@ main(int argc, char **argv)
{
{
fprintf
(
stderr
,
"FETCH ALL command didn't return tuples properly
\n
"
);
fprintf
(
stderr
,
"FETCH ALL command didn't return tuples properly
\n
"
);
PQclear
(
res1
);
PQclear
(
res1
);
exit_nicely
(
conn1
,
NULL
);
exit_nicely
(
conn1
,
conn2
);
}
}
/* first, print out the attribute names */
/* first, print out the attribute names */
...
@@ -142,10 +142,10 @@ main(int argc, char **argv)
...
@@ -142,10 +142,10 @@ main(int argc, char **argv)
res1
=
PQexec
(
conn1
,
"END"
);
res1
=
PQexec
(
conn1
,
"END"
);
PQclear
(
res1
);
PQclear
(
res1
);
/* close the connection to the database and cleanup */
/* close the connection
s
to the database and cleanup */
PQfinish
(
conn1
);
PQfinish
(
conn1
);
PQfinish
(
conn2
);
/* fclose(debug); */
/* fclose(debug); */
return
0
;
/* Though PQfinish(conn1) has called
return
0
;
* exit(1) */
}
}
src/test/examples/testlo.c
View file @
b84788de
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/test/examples/testlo.c,v 1.2
2 2004/08/29 04:13:12 momjian
Exp $
* $PostgreSQL: pgsql/src/test/examples/testlo.c,v 1.2
3 2004/09/22 05:12:45 neilc
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -99,6 +99,7 @@ pickout(PGconn *conn, Oid lobjId, int start, int len)
...
@@ -99,6 +99,7 @@ pickout(PGconn *conn, Oid lobjId, int start, int len)
if
(
nbytes
<=
0
)
if
(
nbytes
<=
0
)
break
;
/* no more data? */
break
;
/* no more data? */
}
}
free
(
buf
);
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
lo_close
(
conn
,
lobj_fd
);
lo_close
(
conn
,
lobj_fd
);
}
}
...
@@ -134,6 +135,7 @@ overwrite(PGconn *conn, Oid lobjId, int start, int len)
...
@@ -134,6 +135,7 @@ overwrite(PGconn *conn, Oid lobjId, int start, int len)
break
;
break
;
}
}
}
}
free
(
buf
);
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
lo_close
(
conn
,
lobj_fd
);
lo_close
(
conn
,
lobj_fd
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment