diff options
author | Michael Meskes <meskes@postgresql.org> | 2015-02-05 15:12:34 +0100 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2015-08-12 13:56:57 +0200 |
commit | ed089d2fec8dde61d169f1f67a96e099425e77c7 (patch) | |
tree | ae3e1560241043b826891c8007c8c8f54d8a9d73 /src/interfaces/ecpg/ecpglib/descriptor.c | |
parent | a54875602a057f8ee0cf5e880bfe2056b5dd11f0 (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 ff011bd8165..15fd7a08a53 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -446,7 +446,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) { @@ -454,7 +454,6 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...) return false; } *(void **) var = mem; - ecpg_add_mem(mem, lineno); var = mem; } @@ -524,7 +523,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) { @@ -532,7 +531,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; } |