/* dynamic SQL support routines
*
- * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.15 2006/06/21 10:24:40 meskes Exp $
+ * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.16 2006/06/25 09:38:39 meskes Exp $
*/
#define POSTGRES_ECPG_INTERNAL
return false;
}
/* allocate storage if needed */
- if (arrsize == 0 && var != NULL && *(void **) var == NULL)
+ if (arrsize == 0 && *(void **) var == NULL)
{
void *mem = (void *) ECPGalloc(offset * ntuples, lineno);
if (!mem)
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.48 2006/06/21 11:38:07 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.49 2006/06/25 09:38:39 meskes Exp $ */
/*
* The aim is to get a simpler inteface to the database routines.
if (!(mallocedval = ECPGrealloc(mallocedval, strlen(mallocedval) + slen + sizeof("array [] "), lineno)))
{
PGTYPESnumeric_free(nval);
- free(str);
+ ECPGfree(str);
return false;
}
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
strcpy(mallocedval + strlen(mallocedval), ",");
+ ECPGfree(str);
+ PGTYPESnumeric_free(nval);
}
- PGTYPESnumeric_free(nval);
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
}
else
strncpy(mallocedval, str, slen);
mallocedval[slen] = '\0';
+ ECPGfree(str);
+ PGTYPESnumeric_free(nval);
}
*tobeinserted_p = mallocedval;
*malloced_p = true;
- PGTYPESnumeric_free(nval);
- free(str);
}
break;
strcpy(mallocedval + strlen(mallocedval), "interval ");
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
strcpy(mallocedval + strlen(mallocedval), ",");
+ ECPGfree(str);
}
strcpy(mallocedval + strlen(mallocedval) - 1, "]");
}
strcpy(mallocedval, "interval ");
/* also copy trailing '\0' */
strncpy(mallocedval + strlen(mallocedval), str, slen + 1);
+ ECPGfree(str);
}
*tobeinserted_p = mallocedval;
*malloced_p = true;
- ECPGfree(str);
}
break;
if (desc == NULL)
{
ECPGraise(stmt->lineno, ECPG_UNKNOWN_DESCRIPTOR, ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME, var->pointer);
+ ECPGfree(copiedquery);
return false;
}
desc_inlist.ind_offset = 0;
}
if (!ECPGstore_input(stmt->lineno, stmt->force_indicator, &desc_inlist, &tobeinserted, &malloced))
+ {
+ ECPGfree(copiedquery);
return false;
+ }
break;
}