Changeset: e41cc91edb46 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e41cc91edb46
Modified Files:
common/stream/stream.c
sql/backends/monet5/UDF/pyapi/type_conversion.c
Branch: malerrors
Log Message:
proper size of buffer
diffs (56 lines):
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -5534,19 +5534,18 @@ stream_fwf_close(stream *s)
static void
stream_fwf_destroy(stream *s)
{
- if (s) {
- stream_fwf_close(s);
- destroy(s);
- }
-}
-
-stream*
-stream_fwf_create (stream *s, size_t num_fields, size_t *widths, char filler)
+ stream_fwf_close(s);
+ destroy(s);
+}
+
+stream *
+stream_fwf_create(stream *s, size_t num_fields, size_t *widths, char filler)
{
stream *ns;
stream_fwf_data *fsd = malloc(sizeof(stream_fwf_data));
size_t i, out_buf_len;
- if (!fsd) {
+
+ if (fsd == NULL) {
return NULL;
}
fsd->s = s;
@@ -5594,11 +5593,10 @@ stream_fwf_create (stream *s, size_t num
}
ns->read = stream_fwf_read;
ns->close = stream_fwf_close;
+ ns->destroy = stream_fwf_destroy;
ns->write = NULL;
ns->flush = NULL;
ns->access = ST_READ;
ns->stream_data.p = fsd;
- ns->destroy = stream_fwf_destroy;
return ns;
}
-
diff --git a/sql/backends/monet5/UDF/pyapi/type_conversion.c
b/sql/backends/monet5/UDF/pyapi/type_conversion.c
--- a/sql/backends/monet5/UDF/pyapi/type_conversion.c
+++ b/sql/backends/monet5/UDF/pyapi/type_conversion.c
@@ -95,7 +95,7 @@ str pyobject_to_str(PyObject **ptr, size
utf8_string = *value;
if (!utf8_string) {
- utf8_string = (str)malloc(len = (pyobject_get_size(obj) *
sizeof(char)));
+ utf8_string = (str)malloc(len = (pyobject_get_size(obj) *
sizeof(char)) + 1);
if (!utf8_string) {
msg = createException(MAL, "pyapi.eval",
"SQLSTATE
HY001 !"MAL_MALLOC_FAIL "python string");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list