1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

netapi: add NetApiBufferAllocate.

Guenther
(This used to be commit 99cc8f023b)
This commit is contained in:
Günther Deschner 2008-08-01 16:44:05 +02:00
parent c7c3510810
commit e480162e5b
2 changed files with 33 additions and 0 deletions

View File

@ -309,6 +309,33 @@ const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
/****************************************************************
****************************************************************/
NET_API_STATUS NetApiBufferAllocate(uint32_t byte_count,
void **buffer)
{
void *buf = NULL;
if (!buffer) {
return W_ERROR_V(WERR_INSUFFICIENT_BUFFER);
}
if (byte_count == 0) {
goto done;
}
buf = talloc_size(NULL, byte_count);
if (!buf) {
return W_ERROR_V(WERR_NOMEM);
}
done:
*buffer = buf;
return NET_API_STATUS_SUCCESS;
}
/****************************************************************
****************************************************************/
NET_API_STATUS NetApiBufferFree(void *buffer)
{
if (!buffer) {

View File

@ -400,6 +400,12 @@ const char *libnetapi_errstr(NET_API_STATUS status);
const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx,
NET_API_STATUS status);
/****************************************************************
NetApiBufferAllocate
****************************************************************/
NET_API_STATUS NetApiBufferAllocate(uint32_t byte_count,
void **buffer);
/****************************************************************
NetApiBufferFree