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

First check, then use.


diffs (17 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
@@ -2872,11 +2872,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);
+               ret = GDKmalloc(_s);
                if(ret == NULL){
                        BBPunfix(b->batCacheid);
                        throw(SQL, "zero_or_one", SQLSTATE(HY001) 
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
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to