diff options
author | Michael Meskes <meskes@postgresql.org> | 2015-02-05 15:12:34 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2015-02-05 15:12:34 +0100 |
commit | 5ee5bc387319b9ac33083bacebd3ab7046666328 (patch) | |
tree | e91d18d6b121852c795ef1c90ba40087be3c3f71 /src/interfaces/ecpg/ecpglib/descriptor.c | |
parent | d88976cfa1302e8dccdcbfe55e9e29faee8c0cdf (diff) |
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 <michael@otacoo.com>
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/descriptor.c')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/descriptor.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index b2990cab289..956c035be7b 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -432,7 +432,7 @@ 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) { @@ -440,7 +440,6 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) return false; } *(void **) var = mem; - ecpg_add_mem(mem, lineno); var = mem; } @@ -510,7 +509,7 @@ 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) { @@ -518,7 +517,6 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) return false; } *(void **) data_var.ind_pointer = mem; - ecpg_add_mem(mem, lineno); data_var.ind_value = mem; } |