From a2b2565fc9318b8903ef4821bc0be40a64810aec Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Thu, 5 Feb 2015 15:12:34 +0100 Subject: This routine was calling ecpg_alloc to allocate to memory but did not actually check the returned pointer allocated, potentially NULL which could be the result of a malloc call. Issue noted by Coverity, fixed by Michael Paquier --- src/interfaces/ecpg/ecpglib/descriptor.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/interfaces/ecpg/ecpglib/descriptor.c') diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index 78a843f7800..75a2b5699ec 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -410,12 +410,11 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) /* allocate storage if needed */ if (arrsize == 0 && *(void **) var == NULL) { - void *mem = (void *) ecpg_alloc(offset * ntuples, lineno); + void *mem = (void *) ecpg_auto_alloc(offset * ntuples, lineno); if (!mem) return false; *(void **) var = mem; - ecpg_add_mem(mem, lineno); var = mem; } @@ -480,12 +479,11 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) /* allocate storage if needed */ if (data_var.ind_arrsize == 0 && data_var.ind_value == NULL) { - void *mem = (void *) ecpg_alloc(data_var.ind_offset * ntuples, lineno); + void *mem = (void *) ecpg_auto_alloc(data_var.ind_offset * ntuples, lineno); if (!mem) return false; *(void **) data_var.ind_pointer = mem; - ecpg_add_mem(mem, lineno); data_var.ind_value = mem; } -- cgit v1.2.3