Changeset: cea92ed3153a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cea92ed3153a
Modified Files:
        monetdb5/mal/mal_dataflow.c
Branch: default
Log Message:

Use realloc instead of malloc+free.


diffs (23 lines):

diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -1124,16 +1124,15 @@ DFLOWscheduler(DataFlow flow)
                                f->error = MAL_SUCCEED;
                        } else {
                                /* collect all errors encountered */
-                               str z = (char *) GDKmalloc(strlen(ret) + 
strlen(f->error) + 2);
+                               str z = (char *) GDKrealloc(ret, strlen(ret) + 
strlen(f->error) + 2);
                                if (z) {
-                                       strcpy(z, ret);
                                        if (z[strlen(z) - 1] != '\n')
                                                strcat(z, "\n");
                                        strcat(z, f->error);
-                                       GDKfree(f->error);
-                                       GDKfree(ret);
                                        ret = z;
                                }
+                               GDKfree(f->error);
+                               f->error = MAL_SUCCEED;
                        }
                        /* first error terminates the batch a.s.a.p. */
                        todo = 0;
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to