Changeset: bc7f7241497d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bc7f7241497d
Modified Files:
        monetdb5/mal/mal.h
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_parser.c
        monetdb5/mal/mel.h
Branch: default
Log Message:

ABI changing fix for MAL parser leak.


diffs (57 lines):

diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -108,8 +108,7 @@ typedef struct SYMDEF {
        struct SYMDEF *skip;            /* skip to next different symbol */
        const char *name;
        int kind;                                       /* what kind of symbol 
*/
-       bool allocated:1;                       /* allocated using mallocs or 
compiled inside the binary */
-       bool fallocated:1;                      /* func contents was malloced */
+       bool allocated;                         /* allocated using mallocs or 
compiled inside the binary */
        struct MALBLK *def;                     /* the details of the MAL fcn */
        mel_func *func;
 } *Symbol, SymRecord;
diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c
--- a/monetdb5/mal/mal_instruction.c
+++ b/monetdb5/mal/mal_instruction.c
@@ -75,7 +75,7 @@ freeSymbol(Symbol s)
                freeMalBlk(s->def);
                s->def = NULL;
        } else if (s->allocated && s->func) {
-               if (s->fallocated) {
+               if (s->func->allocated) {
                        GDKfree(s->func->args);
                        GDKfree((void *) s->func->comment);
                        GDKfree((void *) s->func->cname);
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
@@ -1402,6 +1402,7 @@ fcnCommandPatternHeader(Client ctx, int 
                return NULL;
        }
        *curFunc = (mel_func) {
+               .allocated = true,
                .command = kind == COMMANDsymbol,
                .fcn = fnme,
                .mod = modnme,
@@ -1550,7 +1551,6 @@ parseCommandPattern(Client ctx, int kind
        curPrg->func = curFunc;
        curPrg->def = NULL;
        curPrg->allocated = true;
-       curPrg->fallocated = true;
 
        skipSpace(ctx);
        if (MALkeyword(ctx, "address", 7)) {
diff --git a/monetdb5/mal/mel.h b/monetdb5/mal/mel.h
--- a/monetdb5/mal/mel.h
+++ b/monetdb5/mal/mel.h
@@ -74,7 +74,8 @@ typedef struct __attribute__((__designat
        const char *fcn;
        const char *cname;
        const char *comment;
-       uint32_t command:1, unsafe:1, vargs:1, vrets:1, poly:3, retc:5, argc:5;
+       uint32_t poly:3, retc:5, argc:5;
+       bool command:1, unsafe:1, vargs:1, vrets:1, allocated:1;
        union {
                MALfcn imp;
                char *(*pimp)(struct CLIENT *, struct MALBLK *, struct MALSTK 
*, struct INSTR *);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to