summaryrefslogtreecommitdiff
path: root/ratox.c
diff options
context:
space:
mode:
Diffstat (limited to 'ratox.c')
-rw-r--r--ratox.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ratox.c b/ratox.c
index 6a1e8a7..9e129c7 100644
--- a/ratox.c
+++ b/ratox.c
@@ -1025,14 +1025,14 @@ datasave(void)
tox_get_savedata(tox, intermediate);
+ sz += encryptsavefile ? TOX_PASS_ENCRYPTION_EXTRA_LENGTH : 0;
+ data = malloc(sz);
+ if(!data)
+ eprintf("malloc:");
+
if (encryptsavefile){
- sz += TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
- data = malloc(sz);
- if (!data)
- eprintf("malloc:");
tox_pass_encrypt(intermediate, sz - TOX_PASS_ENCRYPTION_EXTRA_LENGTH, passphrase, pplen, data, NULL);
} else {
- data = malloc(sz);
memcpy(data, intermediate, sz);
}
if (write(fd, data, sz) != sz)