| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1136,7 +1136,6 @@ int convert_to_string(PathIterator &path, | |||
| 1136 | 1136 | ||
| 1137 | 1137 | *buffersize = path.total_vertices() * (precision + 5) * 4; | |
| 1138 | 1138 | if (*buffersize == 0) { | |
| 1139 | - *buffer = NULL; | ||
| 1140 | 1139 | return 0; | |
| 1141 | 1140 | } | |
| 1142 | 1141 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -638,8 +638,9 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject * | |||
| 638 | 638 | PyObject *codesobj; | |
| 639 | 639 | char *codes[5]; | |
| 640 | 640 | int postfix; | |
| 641 | - char *buffer; | ||
| 641 | + char *buffer = NULL; | ||
| 642 | 642 | size_t buffersize; | |
| 643 | + PyObject *result; | ||
| 643 | 644 | int status; | |
| 644 | 645 | ||
| 645 | 646 | if (!PyArg_ParseTuple(args, | |
@@ -702,10 +703,14 @@ static PyObject *Py_convert_to_string(PyObject *self, PyObject *args, PyObject * | |||
| 702 | 703 | } | |
| 703 | 704 | ||
| 704 | 705 | if (buffersize == 0) { | |
| 705 | - return PyBytes_FromString(""); | ||
| 706 | + result = PyBytes_FromString(""); | ||
| 706 | 707 | } else { | |
| 707 | - return PyBytes_FromStringAndSize(buffer, buffersize); | ||
| 708 | + result = PyBytes_FromStringAndSize(buffer, buffersize); | ||
| 708 | 709 | } | |
| 710 | + | ||
| 711 | + free(buffer); | ||
| 712 | + | ||
| 713 | + return result; | ||
| 709 | 714 | } | |
| 710 | 715 | ||
| 711 | 716 | extern "C" { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1032,6 +1032,8 @@ static PyObject *PyFT2Font_get_name_index(PyFT2Font *self, PyObject *args, PyObj | |||
| 1032 | 1032 | ||
| 1033 | 1033 | CALL_CPP("get_name_index", name_index = self->x->get_name_index(glyphname)); | |
| 1034 | 1034 | ||
| 1035 | + PyMem_Free(glyphname); | ||
| 1036 | + | ||
| 1035 | 1037 | return PyLong_FromLong(name_index); | |
| 1036 | 1038 | } | |
| 1037 | 1039 | ||
@@ -1085,6 +1087,8 @@ static PyObject *PyFT2Font_get_sfnt_table(PyFT2Font *self, PyObject *args, PyObj | |||
| 1085 | 1087 | } | |
| 1086 | 1088 | } | |
| 1087 | 1089 | ||
| 1090 | + PyMem_Free(tagname); | ||
| 1091 | + | ||
| 1088 | 1092 | void *table = FT_Get_Sfnt_Table(self->x->get_face(), (FT_Sfnt_Tag)tag); | |
| 1089 | 1093 | if (!table) { | |
| 1090 | 1094 | Py_RETURN_NONE; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments