diff options
author | Michael Meskes <meskes@postgresql.org> | 2006-06-21 10:29:50 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2006-06-21 10:29:50 +0000 |
commit | 08f197391135951f7e60d65457103307dea89f0c (patch) | |
tree | 7d7f4c50018106b89d9d47cc4816145c33d0c5b1 /src/interfaces/ecpg/ecpglib/descriptor.c | |
parent | 23623f05f05fcdc3142e83bf21cf4dc10e16aafd (diff) |
Added fixes from the coverity report send in by Joachim Wieland <joe@mcknight.de>
Added missing error handling in a few functions in ecpglib.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/descriptor.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/descriptor.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index e81df0e5614..3ecc15a5ad7 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -1,6 +1,6 @@ /* dynamic SQL support routines * - * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.12.6.2 2006/01/15 22:47:10 neilc Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.12.6.3 2006/06/21 10:29:50 meskes Exp $ */ #define POSTGRES_ECPG_INTERNAL @@ -351,8 +351,9 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) /* allocate storage if needed */ if (arrsize == 0 && var != NULL && *(void **) var == NULL) { - void *mem = (void *) ECPGalloc(offset * ntuples, lineno); - + void *mem = (void *) ECPGalloc(offset * ntuples, lineno); + if (!mem) + return false; *(void **) var = mem; ECPGadd_mem(mem, lineno); var = mem; @@ -412,8 +413,9 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) /* allocate storage if needed */ if (data_var.ind_arrsize == 0 && data_var.ind_pointer != NULL && data_var.ind_value == NULL) { - void *mem = (void *) ECPGalloc(data_var.ind_offset * ntuples, lineno); - + void *mem = (void *) ECPGalloc(data_var.ind_offset * ntuples, lineno); + if (!mem) + return false; *(void **) data_var.ind_pointer = mem; ECPGadd_mem(mem, lineno); data_var.ind_value = mem; @@ -480,6 +482,8 @@ ECPGset_desc(int lineno, const char *desc_name, int index,...) if (desc_item == NULL) { desc_item = (struct descriptor_item *) ECPGalloc(sizeof(*desc_item), lineno); + if (!desc_item) + return false; desc_item->num = index; desc_item->next = desc->items; desc->items = desc_item; |