1- /* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.26 2005/10/15 02 :49:47 momjian Exp $ */
1+ /* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.27 2005/11/30 12 :49:49 meskes Exp $ */
22
33#define POSTGRES_ECPG_INTERNAL
44#include "postgres_fe.h"
@@ -265,7 +265,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
265265 struct sqlca_t * sqlca = ECPGget_sqlca ();
266266 enum COMPAT_MODE compat = c ;
267267 struct connection * this ;
268- char * dbname = name ? strdup (name ) : NULL ,
268+ char * dbname = name ? ECPGstrdup (name , lineno ) : NULL ,
269269 * host = NULL ,
270270 * tmp ,
271271 * port = NULL ,
@@ -287,7 +287,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
287287 if (envname )
288288 {
289289 ECPGfree (dbname );
290- dbname = strdup (envname );
290+ dbname = ECPGstrdup (envname , lineno );
291291 }
292292
293293 }
@@ -307,17 +307,17 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
307307 tmp = strrchr (dbname , ':' );
308308 if (tmp != NULL ) /* port number given */
309309 {
310- port = strdup (tmp + 1 );
310+ port = ECPGstrdup (tmp + 1 , lineno );
311311 * tmp = '\0' ;
312312 }
313313
314314 tmp = strrchr (dbname , '@' );
315315 if (tmp != NULL ) /* host name given */
316316 {
317- host = strdup (tmp + 1 );
317+ host = ECPGstrdup (tmp + 1 , lineno );
318318 * tmp = '\0' ;
319319 }
320- realname = strdup (dbname );
320+ realname = ECPGstrdup (dbname , lineno );
321321 }
322322 else if (strncmp (dbname , "tcp:" , 4 ) == 0 || strncmp (dbname , "unix:" , 5 ) == 0 )
323323 {
@@ -345,14 +345,14 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
345345 tmp = strrchr (dbname + offset , '?' );
346346 if (tmp != NULL ) /* options given */
347347 {
348- options = strdup (tmp + 1 );
348+ options = ECPGstrdup (tmp + 1 , lineno );
349349 * tmp = '\0' ;
350350 }
351351
352352 tmp = last_dir_separator (dbname + offset );
353353 if (tmp != NULL ) /* database name given */
354354 {
355- realname = strdup (tmp + 1 );
355+ realname = ECPGstrdup (tmp + 1 , lineno );
356356 * tmp = '\0' ;
357357 }
358358
@@ -365,7 +365,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
365365 if ((tmp2 = strchr (tmp + 1 , ':' )) != NULL )
366366 {
367367 * tmp2 = '\0' ;
368- host = strdup (tmp + 1 );
368+ host = ECPGstrdup (tmp + 1 , lineno );
369369 if (strncmp (dbname , "unix:" , 5 ) != 0 )
370370 {
371371 ECPGlog ("connect: socketname %s given for TCP connection in line %d\n" , host , lineno );
@@ -384,7 +384,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
384384 }
385385 }
386386 else
387- port = strdup (tmp + 1 );
387+ port = ECPGstrdup (tmp + 1 , lineno );
388388 }
389389
390390 if (strncmp (dbname , "unix:" , 5 ) == 0 )
@@ -407,14 +407,14 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
407407 }
408408 }
409409 else
410- host = strdup (dbname + offset );
410+ host = ECPGstrdup (dbname + offset , lineno );
411411
412412 }
413413 else
414- realname = strdup (dbname );
414+ realname = ECPGstrdup (dbname , lineno );
415415 }
416416 else
417- realname = strdup (dbname );
417+ realname = ECPGstrdup (dbname , lineno );
418418 }
419419 else
420420 realname = NULL ;
0 commit comments