Changeset: 12b39aab67fe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=12b39aab67fe
Modified Files:
        common/stream/stream.c
Branch: default
Log Message:

Some allocation checks on stream module


diffs (36 lines):

diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -695,6 +695,10 @@ create_stream(const char *name)
        s->isutf8 = 0;          /* not known for sure */
        s->type = ST_ASCII;
        s->name = strdup(name);
+       if(s->name == NULL) {
+               free(s);
+               return NULL;
+       }
        s->stream_data.p = NULL;
        s->errnr = MNSTR_NO__ERROR;
        s->read = NULL;
@@ -2704,6 +2708,10 @@ file_rastream(FILE *restrict fp, const c
 #ifdef _MSC_VER
        if (fileno(fp) == 0 && isatty(0)) {
                struct console *c = malloc(sizeof(struct console));
+               if(c == NULL) {
+                       destroy(s);
+                       return NULL;
+               }
                s->stream_data.p = c;
                c->h = GetStdHandle(STD_INPUT_HANDLE);
                c->i = 0;
@@ -2741,6 +2749,10 @@ file_wastream(FILE *restrict fp, const c
 #ifdef _MSC_VER
        if ((fileno(fp) == 1 || fileno(fp) == 2) && isatty(fileno(fp))) {
                struct console *c = malloc(sizeof(struct console));
+               if(c == NULL) {
+                       destroy(s);
+                       return NULL;
+               }
                s->stream_data.p = c;
                c->h = GetStdHandle(STD_OUTPUT_HANDLE);
                c->i = 0;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to