Changeset: 21bd40b73654 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=21bd40b73654
Modified Files:
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_parser.c
        monetdb5/modules/atoms/str.c
        monetdb5/modules/atoms/url.c
Branch: Jul2017
Log Message:

Fixed some errors found by -Wnull-dereference.


diffs (55 lines):

diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c
--- a/monetdb5/mal/mal_interpreter.c
+++ b/monetdb5/mal/mal_interpreter.c
@@ -830,8 +830,10 @@ str runMALsequence(Client cntxt, MalBlkP
                                                        continue;
                                                }
                                                b = 
BATdescriptor(stk->stk[getArg(pci, i)].val.bval);
-                                               BATassertProps(b);
-                                               BBPunfix(b->batCacheid);
+                                               if (b) {
+                                                       BATassertProps(b);
+                                                       BBPunfix(b->batCacheid);
+                                               }
                                        }
                                }
                        }
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -322,7 +322,7 @@ lastline(Client cntxt)
        str s = CURRENT(cntxt);
        if (NL(*s))
                s++;
-       while (s && s > cntxt->fdin->buf && !NL(*s))
+       while (s > cntxt->fdin->buf && !NL(*s))
                s--;
        if (NL(*s))
                s++;
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1716,7 +1716,7 @@ STRWChrAt(int *res, const str *arg1, con
                return MAL_SUCCEED;
        }
        s = UTF8_strtail(s, *at);
-       if (*s == 0) {
+       if (s == NULL || *s == 0) {
                *res = int_nil;
                return MAL_SUCCEED;
        }
diff --git a/monetdb5/modules/atoms/url.c b/monetdb5/modules/atoms/url.c
--- a/monetdb5/modules/atoms/url.c
+++ b/monetdb5/modules/atoms/url.c
@@ -114,9 +114,9 @@ skip_authority(const char *uri, const ch
                        if (passp)
                                *passp = NULL;
                } else {
-                       if (*userp)
+                       if (userp)
                                *userp = user;
-                       if (*passp)
+                       if (passp)
                                *passp = pass;
                }
                if (portp)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to