Fix uninitialized use of 'allocbuf' variable, in case of out-of-memory.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 12 Jun 2013 11:03:37 +0000 (14:03 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 12 Jun 2013 11:06:29 +0000 (14:06 +0300)
Compiler warned about this. If ENLARGE_NEWSTATEMENT macro ran out of memory,
it would jump to cleanup routine. The cleanup would check if allocbuf is
NULL, and try to free() it if not. allocbuf needs to be initialized to NULL
before the first ENLARGE_NEWSTATEMENT macro invocation.

convert.c

index 00f35ca354f92976b6a802374422beb3949bc92f..00abc9a268a43012e599e933bd65e942d6109086 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -3940,7 +3940,7 @@ ResolveOneParam(QueryBuild *qb, QueryParse *qp)
    struct tm   tm;
 #endif /* HAVE_LOCALTIME_R */
    SQLLEN      used;
-   char        *buffer, *buf, *allocbuf, *lastadd = NULL;
+   char        *buffer, *buf, *allocbuf = NULL, *lastadd = NULL;
    OID     lobj_oid;
    int     lobj_fd;
    SQLULEN offset = apdopts->param_offset_ptr ? *apdopts->param_offset_ptr : 0;