#include "includes.h"
-/*******************************************************************
- free() a data blob
-*******************************************************************/
-static void free_data_blob(DATA_BLOB *d)
-{
- if ((d) && (d->free)) {
- SAFE_FREE(d->data);
- }
-}
-
/*******************************************************************
construct a data blob, must be freed with data_blob_free()
you can pass NULL for p and get a blank data blob
{
DATA_BLOB ret;
- if (!length) {
+ if (length == 0) {
ZERO_STRUCT(ret);
return ret;
}
ret.data = smb_xmalloc(length);
}
ret.length = length;
- ret.free = free_data_blob;
return ret;
}
smb_panic("data_blob_talloc: talloc_memdup failed.\n");
}
ret.length = length;
- ret.free = NULL;
return ret;
}
}
ret.length = length;
- ret.free = NULL;
return ret;
}
void data_blob_free(DATA_BLOB *d)
{
if (d) {
- if (d->free) {
- (d->free)(d);
- }
+ free(d->data);
d->data = NULL;
d->length = 0;
}