Ron Peterson <ron.peterson@xxxxxxxxxxxxxx> writes: > char* > tp2cp_palloc( char* stringp, const text* textp ) { > int len; > len = VARSIZE(textp) - VARHDRSZ; > stringp = (char*)palloc( len + 1 ); > if( ! memcpy( stringp, VARDATA(textp), len ) ) { return NULL; } > if( ! memset( stringp + len, '\0', 1 ) ) { return NULL; } > return stringp; > } That's simply bizarre coding style. stringp should be a local in tp2cp_palloc, not a passed parameter that you ignore the value of. > Which I call like > otherfunc() { > char* rd; > if( ! tp2cp_palloc( rd, rand_dev ) ) > ... The above does not cause rd to become set in otherfunc(). Had you been using a reasonable set of compiler flags, the compiler would have warned you that rd was uninitialized in otherfunc(). regards, tom lane