summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/asn1.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source3/libsmb/asn1.c b/source3/libsmb/asn1.c
index 6a92a6be00..e72da897b9 100644
--- a/source3/libsmb/asn1.c
+++ b/source3/libsmb/asn1.c
@@ -32,11 +32,14 @@ BOOL asn1_write(ASN1_DATA *data, const void *p, int len)
{
if (data->has_error) return False;
if (data->length < data->ofs+len) {
- data->data = Realloc(data->data, data->ofs+len);
- if (!data->data) {
+ uint8 *p;
+ p = Realloc(data->data, data->ofs+len);
+ if (!p) {
+ SAFE_FREE(data->data);
data->has_error = True;
return False;
}
+ data->data = p;
data->length = data->ofs+len;
}
memcpy(data->data + data->ofs, p, len);