mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
r6678: fix python python after talloc() shakeup
This commit is contained in:
parent
3b2cd19fcb
commit
f629bffb1a
@ -167,7 +167,7 @@ static PyObject *lsa_lookup_names(PyObject *self, PyObject *args)
|
||||
/* Convert list to char ** array */
|
||||
|
||||
num_names = PyList_Size(py_names);
|
||||
names = (const char **)talloc(mem_ctx, num_names * sizeof(char *));
|
||||
names = (const char **)_talloc(mem_ctx, num_names * sizeof(char *));
|
||||
|
||||
for (i = 0; i < num_names; i++) {
|
||||
PyObject *obj = PyList_GetItem(py_names, i);
|
||||
@ -180,7 +180,7 @@ static PyObject *lsa_lookup_names(PyObject *self, PyObject *args)
|
||||
/* Just a single element */
|
||||
|
||||
num_names = 1;
|
||||
names = (const char **)talloc(mem_ctx, sizeof(char *));
|
||||
names = (const char **)_talloc(mem_ctx, sizeof(char *));
|
||||
|
||||
names[0] = PyString_AsString(py_names);
|
||||
}
|
||||
@ -241,7 +241,7 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
|
||||
/* Convert dictionary to char ** array */
|
||||
|
||||
num_sids = PyList_Size(py_sids);
|
||||
sids = (DOM_SID *)talloc(mem_ctx, num_sids * sizeof(DOM_SID));
|
||||
sids = (DOM_SID *)_talloc(mem_ctx, num_sids * sizeof(DOM_SID));
|
||||
|
||||
memset(sids, 0, num_sids * sizeof(DOM_SID));
|
||||
|
||||
@ -259,7 +259,7 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
|
||||
/* Just a single element */
|
||||
|
||||
num_sids = 1;
|
||||
sids = (DOM_SID *)talloc(mem_ctx, sizeof(DOM_SID));
|
||||
sids = (DOM_SID *)_talloc(mem_ctx, sizeof(DOM_SID));
|
||||
|
||||
if (!string_to_sid(&sids[0], PyString_AsString(py_sids))) {
|
||||
PyErr_SetString(PyExc_ValueError, "string_to_sid failed");
|
||||
|
@ -157,7 +157,7 @@ BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict, TALLOC_CTX *mem_ctx)
|
||||
|
||||
acl->num_aces = PyList_Size(obj);
|
||||
|
||||
acl->ace = talloc(mem_ctx, acl->num_aces * sizeof(SEC_ACE));
|
||||
acl->ace = _talloc(mem_ctx, acl->num_aces * sizeof(SEC_ACE));
|
||||
acl->size = SEC_ACL_HEADER_SIZE;
|
||||
|
||||
for (i = 0; i < acl->num_aces; i++) {
|
||||
|
@ -235,7 +235,7 @@ static PyObject *py_smb_read(PyObject *self, PyObject *args, PyObject *kw)
|
||||
if (size < 1 || size > fsize - offset)
|
||||
size = fsize - offset;
|
||||
|
||||
if (!(data = (char *) malloc((size_t) size))) {
|
||||
if (!(data = SMB_XMALLOC_ARRAY(char, size))) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "malloc failed");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ static uint16 *to_dependentfiles(PyObject *list, TALLOC_CTX *mem_ctx)
|
||||
size+=PyString_Size(borrowedRef)+1;
|
||||
}
|
||||
|
||||
if (!(ret = (uint16*) talloc(mem_ctx,(size+1)*sizeof(uint16))))
|
||||
if (!(ret = (uint16*)_talloc(mem_ctx,((size+1)*sizeof(uint16)))))
|
||||
goto done;
|
||||
|
||||
/* create null terminated sequence of null terminated strings */
|
||||
|
@ -43,7 +43,7 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
server = strdup(unc_name + 2);
|
||||
server = SMB_XSTRDUP(unc_name + 2);
|
||||
|
||||
if (strchr(server, '\\')) {
|
||||
char *c = strchr(server, '\\');
|
||||
|
@ -291,7 +291,7 @@ BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict,
|
||||
|| !PyDict_Check(obj))
|
||||
goto done;
|
||||
|
||||
info->devmode = talloc(mem_ctx, sizeof(DEVICEMODE));
|
||||
info->devmode = _talloc(mem_ctx, sizeof(DEVICEMODE));
|
||||
|
||||
if (!py_to_DEVICEMODE(info->devmode, obj))
|
||||
goto done;
|
||||
|
@ -93,7 +93,7 @@ PyObject *srvsvc_netservergetinfo(PyObject *self, PyObject *args,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
server = strdup(unc_name + 2);
|
||||
server = SMB_XSTRDUP(unc_name + 2);
|
||||
|
||||
if (strchr(server, '\\')) {
|
||||
char *c = strchr(server, '\\');
|
||||
|
@ -348,7 +348,7 @@ static BOOL make_lock_list(PyObject *py_keys, TDB_DATA **keys, int *num_keys)
|
||||
/* Turn python list into array of keys */
|
||||
|
||||
*num_keys = PyList_Size(py_keys);
|
||||
*keys = (TDB_DATA *)malloc(sizeof(TDB_DATA) * (*num_keys));
|
||||
*keys = (TDB_DATA *)SMB_XMALLOC_ARRAY(TDB_DATA, (*num_keys));
|
||||
|
||||
for (i = 0; i < *num_keys; i++) {
|
||||
PyObject *key = PyList_GetItem(py_keys, i);
|
||||
@ -368,7 +368,7 @@ static BOOL make_lock_list(PyObject *py_keys, TDB_DATA **keys, int *num_keys)
|
||||
|
||||
/* Turn python string into a single key */
|
||||
|
||||
*keys = (TDB_DATA *)malloc(sizeof(TDB_DATA));
|
||||
*keys = (TDB_DATA *)SMB_XMALLOC_P(TDB_DATA);
|
||||
*num_keys = 1;
|
||||
PyArg_Parse(py_keys, "s#", &(*keys)->dptr, &(*keys)->dsize);
|
||||
}
|
||||
|
@ -441,13 +441,14 @@ static void pack_le_uint32(unsigned long val_long, unsigned char *pbuf)
|
||||
}
|
||||
|
||||
|
||||
#if 0 /* not used */
|
||||
static void pack_bytes(long len, const char *from,
|
||||
unsigned char **pbuf)
|
||||
{
|
||||
memcpy(*pbuf, from, len);
|
||||
(*pbuf) += len;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static PyObject *
|
||||
|
Loading…
x
Reference in New Issue
Block a user