projects
/
users
/
bernd
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0707af6
)
Fix our version of strdup() to adhere to the standard semantics for
author
Tom Lane
<tgl@sss.pgh.pa.us>
Tue, 27 Sep 2005 04:53:23 +0000
(
04:53
+0000)
committer
Tom Lane
<tgl@sss.pgh.pa.us>
Tue, 27 Sep 2005 04:53:23 +0000
(
04:53
+0000)
out-of-memory --- that is, return NULL rather than dumping core.
Noted by Qingqing Zhou.
src/port/strdup.c
patch
|
blob
|
blame
|
history
diff --git
a/src/port/strdup.c
b/src/port/strdup.c
index 70a9faf2ee3ff0d3212461da6e7a2036d5376a1f..3facc4a77b36af6716cd74108ec79fb8dcc15e97 100644
(file)
--- a/
src/port/strdup.c
+++ b/
src/port/strdup.c
@@
-19,10
+19,12
@@
char *
-strdup(c
har const *
string)
+strdup(c
onst char *
string)
{
char *nstr;
- nstr = strcpy((char *) malloc(strlen(string) + 1), string);
+ nstr = (char *) malloc(strlen(string) + 1);
+ if (nstr)
+ strcpy(nstr, string);
return nstr;
}