Don't use 0 as a spelling of NULL.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Oct 2003 14:47:44 +0000 (14:47 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Oct 2003 14:47:44 +0000 (14:47 +0000)
src/interfaces/libpq/fe-exec.c

index aadfe0b5f821a74d5ee3da2b95cc86e5cdce2558..6f23fde1e406a3c95d6e6962fe1bc22d740d5d0f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.148 2003/09/22 00:23:35 petere Exp $
+ *   $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.149 2003/10/02 14:47:44 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -2331,12 +2331,15 @@ PQunescapeBytea(const unsigned char *strtext, size_t *retbuflen)
    }
    buflen = j;                 /* buflen is the length of the unquoted
                                 * data */
+
+   /* Shrink the buffer to be no larger than necessary */
    tmpbuf = realloc(buffer, buflen);
 
+   /* It would only be a very brain-dead realloc that could fail, but... */
    if (!tmpbuf)
    {
        free(buffer);
-       return 0;
+       return NULL;
    }
 
    *retbuflen = buflen;