Small fix for _valueCopy() - Mailing list pgsql-patches

From Fernando Nasser
Subject Small fix for _valueCopy()
Date
Msg-id 3C875BBF.62D4145@redhat.com
Whole thread Raw
Responses Re: Small fix for _valueCopy()
List pgsql-patches
Protect against a T_String Value (or other pointer Value) Value
where the pointer is NULL.

If we don't do it, _copyVariableSet() dumps core.

--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9Index: src/backend/nodes/copyfuncs.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v
retrieving revision 1.166
diff -c -p -r1.166 copyfuncs.c
*** src/backend/nodes/copyfuncs.c    2002/03/06 20:34:47    1.166
--- src/backend/nodes/copyfuncs.c    2002/03/07 12:17:35
*************** _copyValue(Value *from)
*** 2571,2577 ****
          case T_Float:
          case T_String:
          case T_BitString:
!             newnode->val.str = pstrdup(from->val.str);
              break;
          default:
              break;
--- 2571,2578 ----
          case T_Float:
          case T_String:
          case T_BitString:
!             if (from->val.str)
!                 newnode->val.str = pstrdup(from->val.str);
              break;
          default:
              break;

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: new hash function
Next
From: Fernando Nasser
Date:
Subject: Small fix for _copyGrantStmt