Changeset: 32c902e067c8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=32c902e067c8
Modified Files:
        sql/backends/monet5/sql.c
Branch: Jul2017
Log Message:

Check correct value, and check before use.


diffs (18 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2747,11 +2747,12 @@ zero_or_one(ptr ret, const bat *bid)
        _s = ATOMsize(ATOMtype(b->ttype));
        if (ATOMextern(b->ttype)) {
                _s = ATOMlen(ATOMtype(b->ttype), p);
-               memcpy(*(ptr *) ret = GDKmalloc(_s), p, _s);
-               if(ret == NULL){
+               *(ptr *) ret = GDKmalloc(_s);
+               if(*(ptr *) ret == NULL){
                        BBPunfix(b->batCacheid);
                        throw(SQL, "zero_or_one", MAL_MALLOC_FAIL);
                }
+               memcpy(*(ptr *) ret, p, _s);
        } else if (b->ttype == TYPE_bat) {
                bat bid = *(bat *) p;
                *(BAT **) ret = BATdescriptor(bid);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to