diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-01-11 18:35:27 -0600 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2022-01-14 20:07:07 -0600 |
commit | e4d0e60d2b8383fe995c518b3eef0007b3e48ab4 (patch) | |
tree | 900e34550e38837476d2139845b7b408f7c6ceba | |
parent | e0e3a72b88d8f52aedb882c75a7df4215a35d466 (diff) | |
download | numpy-e4d0e60d2b8383fe995c518b3eef0007b3e48ab4.tar.gz |
BUG: Fix some issues found by a valgrind run
-rw-r--r-- | numpy/core/src/multiarray/textreading/conversions.c | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/textreading/field_types.c | 1 | ||||
-rw-r--r-- | numpy/core/src/multiarray/textreading/rows.c | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/textreading/conversions.c b/numpy/core/src/multiarray/textreading/conversions.c index 0fb4f05fb..6d68e961d 100644 --- a/numpy/core/src/multiarray/textreading/conversions.c +++ b/numpy/core/src/multiarray/textreading/conversions.c @@ -63,7 +63,7 @@ double_from_ucs4( char *heap_buf = NULL; char *ascii = stack_buf; - size_t str_len = end - str; + size_t str_len = end - str + 1; if (str_len > 128) { heap_buf = PyMem_MALLOC(str_len); if (heap_buf == NULL) { diff --git a/numpy/core/src/multiarray/textreading/field_types.c b/numpy/core/src/multiarray/textreading/field_types.c index e1dbd2984..0722efd57 100644 --- a/numpy/core/src/multiarray/textreading/field_types.c +++ b/numpy/core/src/multiarray/textreading/field_types.c @@ -137,6 +137,7 @@ field_type_grow_recursive(PyArray_Descr *descr, field_types_xclear(num_field_types, *ft); return -1; } + Py_DECREF(tup); num_field_types = field_type_grow_recursive( field_descr, num_field_types, ft, ft_size, field_offset + offset); diff --git a/numpy/core/src/multiarray/textreading/rows.c b/numpy/core/src/multiarray/textreading/rows.c index d3e4e462e..d5004613c 100644 --- a/numpy/core/src/multiarray/textreading/rows.c +++ b/numpy/core/src/multiarray/textreading/rows.c @@ -54,7 +54,7 @@ create_conv_funcs( PyErr_SetString(PyExc_TypeError, "converters must be a dictionary mapping columns to converter " "functions or a single callable."); - return NULL; + goto error; } PyObject *key, *value; |