On Wed, 17 Sep 2003 [EMAIL PROTECTED] wrote:

> > On Wed, 17 Sep 2003 [EMAIL PROTECTED] wrote:
> > 
> > > I have applied the recent tsearch2 patch and recompiled the 
> tsearch2 
> > > module but I am still experiencing the same backend crashes as I 
> > > previously described.
> > 
> > I didn't think your problem was the same as mine.
> > 
> > > #0  SN_create_env (S_size=0, I_size=2, B_size=1) at api.c:6
> > > 6           z->p = create_s();
> > > (gdb) bt
> > > #0  SN_create_env (S_size=0, I_size=2, B_size=1) at api.c:6
> > > #1  0x20000000026be870 in SN_create_env (S_size=40770504, I_size=
> > > 40509856,
> > > B_size=1034) at api.c:6
> > 
> > Is that the full backtrace?
> 
> The gdb session above is quoted above start to finish as displayed on 
> screen. I'm not very famialiar with gdb so please say if I need to do 
> things differently.
> 
> So i think it is the full backtrace - i certainly haven't edited 
> anything.


Trouble is it doesn't look like a decently deep stack. I would have expected to
see a lot more output from the backtrace.

Having said that the z in the z->p = create_s() line mentioned as the place of
the fault is the result of a calloc without checking for a null return from
calloc. Here's a[nother simple] patch to fix that.

It's not going to fix whatever is putting you into the situation that makes
calloc fail though. It'll just make the failure less disasterous.


-- 
Nigel J. Andrews
*** tsearch2/snowball/api.c     Mon Jul  7 15:29:46 2003
--- /tmp/postgresql-7.3.4/contrib/tsearch2/snowball/api.c       Wed Sep 17 22:21:55 
2003
***************
*** 2,8 ****
  #include "header.h"
  
  extern struct SN_env * SN_create_env(int S_size, int I_size, int B_size)
! {   struct SN_env * z = (struct SN_env *) calloc(1, sizeof(struct SN_env));
      z->p = create_s();
      if (S_size)
      {   z->S = (symbol * *) calloc(S_size, sizeof(symbol *));
--- 2,10 ----
  #include "header.h"
  
  extern struct SN_env * SN_create_env(int S_size, int I_size, int B_size)
! {
!     struct SN_env * z = (struct SN_env *) calloc(1, sizeof(struct SN_env));
!     if (!z) return z;
      z->p = create_s();
      if (S_size)
      {   z->S = (symbol * *) calloc(S_size, sizeof(symbol *));
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to