Changeset: 17fe5e1f6200 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=17fe5e1f6200
Modified Files:
        monetdb5/optimizer/opt_reorder.c
Branch: Jul2017
Log Message:

Avoid malloc of size zero.


diffs (17 lines):

diff --git a/monetdb5/optimizer/opt_reorder.c b/monetdb5/optimizer/opt_reorder.c
--- a/monetdb5/optimizer/opt_reorder.c
+++ b/monetdb5/optimizer/opt_reorder.c
@@ -133,8 +133,11 @@ OPTdependencies(Client cntxt, MalBlkPtr 
                list[i]->pos2 = sz;
                sz += list[i]->used;
        }
-       uselist = GDKzalloc(sizeof(int)*sz);
-       if (!uselist) {
+       if (sz == 0 ||
+               (uselist = GDKzalloc(sizeof(int)*sz)) == NULL) {
+               /* there is no distinction between successfully finding
+                * nothing and failure; in either case the caller doesn't do
+                * anything */
                OPTremoveDep(list, mb->stop);
                GDKfree(var);
                return NULL;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to