Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
0e2d3cf2
Kaydet (Commit)
0e2d3cf2
authored
Tem 07, 2013
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #18203: Replace malloc() with PyMem_Malloc() in _PySequence_BytesToCharpArray()
üst
c6632e7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
abstract.c
Objects/abstract.c
+11
-8
No files found.
Objects/abstract.c
Dosyayı görüntüle @
0e2d3cf2
...
...
@@ -1238,7 +1238,7 @@ PyNumber_AsSsize_t(PyObject *item, PyObject *err)
to be an int or have an __int__ method. Steals integral's
reference. error_format will be used to create the TypeError if integral
isn't actually an Integral instance. error_format should be a format string
that can accept a char* naming integral's type.
that can accept a char* naming integral's type.
*/
static
PyObject
*
convert_integral_to_int
(
PyObject
*
integral
,
const
char
*
error_format
)
...
...
@@ -1257,7 +1257,7 @@ convert_integral_to_int(PyObject *integral, const char *error_format)
}
PyErr_Format
(
PyExc_TypeError
,
error_format
,
Py_TYPE
(
integral
)
->
tp_name
);
Py_DECREF
(
integral
);
return
NULL
;
return
NULL
;
}
...
...
@@ -2721,8 +2721,8 @@ PyIter_Next(PyObject *iter)
* NULL terminated string pointers with a NULL char* terminating the array.
* (ie: an argv or env list)
*
* Memory allocated for the returned list is allocated using
malloc() and MUST
*
be freed by the caller using a free() loop or
_Py_FreeCharPArray().
* Memory allocated for the returned list is allocated using
PyMem_Malloc()
*
and MUST be freed by
_Py_FreeCharPArray().
*/
char
*
const
*
_PySequence_BytesToCharpArray
(
PyObject
*
self
)
...
...
@@ -2730,6 +2730,7 @@ _PySequence_BytesToCharpArray(PyObject* self)
char
**
array
;
Py_ssize_t
i
,
argc
;
PyObject
*
item
=
NULL
;
Py_ssize_t
size
;
argc
=
PySequence_Size
(
self
);
if
(
argc
==
-
1
)
...
...
@@ -2742,7 +2743,7 @@ _PySequence_BytesToCharpArray(PyObject* self)
return
NULL
;
}
array
=
m
alloc
((
argc
+
1
)
*
sizeof
(
char
*
));
array
=
PyMem_M
alloc
((
argc
+
1
)
*
sizeof
(
char
*
));
if
(
array
==
NULL
)
{
PyErr_NoMemory
();
return
NULL
;
...
...
@@ -2761,11 +2762,13 @@ _PySequence_BytesToCharpArray(PyObject* self)
array
[
i
]
=
NULL
;
goto
fail
;
}
array
[
i
]
=
strdup
(
data
);
size
=
PyBytes_GET_SIZE
(
item
)
+
1
;
array
[
i
]
=
PyMem_Malloc
(
size
);
if
(
!
array
[
i
])
{
PyErr_NoMemory
();
goto
fail
;
}
memcpy
(
array
[
i
],
data
,
size
);
Py_DECREF
(
item
);
}
array
[
argc
]
=
NULL
;
...
...
@@ -2785,7 +2788,7 @@ _Py_FreeCharPArray(char *const array[])
{
Py_ssize_t
i
;
for
(
i
=
0
;
array
[
i
]
!=
NULL
;
++
i
)
{
f
ree
(
array
[
i
]);
PyMem_F
ree
(
array
[
i
]);
}
f
ree
((
void
*
)
array
);
PyMem_F
ree
((
void
*
)
array
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment