summaryrefslogtreecommitdiff
path: root/libpiano/src/crypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'libpiano/src/crypt.c')
-rw-r--r--libpiano/src/crypt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libpiano/src/crypt.c b/libpiano/src/crypt.c
index 10744e0..c4871dc 100644
--- a/libpiano/src/crypt.c
+++ b/libpiano/src/crypt.c
@@ -26,6 +26,7 @@ THE SOFTWARE.
#include "crypt_key_output.h"
#include "crypt_key_input.h"
+#include "main.h"
/* hex string to array of unsigned int values
* @param hex string
@@ -133,8 +134,8 @@ char *PianoDecryptString (char *strInput) {
PianoDecipherInts (cipherInts, cipherIntsN, &plainInts);
strDecrypted = PianoIntsToString (plainInts, cipherIntsN);
- free (cipherInts);
- free (plainInts);
+ PianoFree (cipherInts, cipherIntsN * sizeof (*cipherInts));
+ PianoFree (plainInts, cipherIntsN * sizeof (*plainInts));
return strDecrypted;
}
@@ -258,8 +259,8 @@ char *PianoEncryptString (char *strInput) {
PianoEncipherInts (plainInts, plainIntsN, &cipherInts);
strHex = PianoIntsToHexString (cipherInts, plainIntsN);
- free (plainInts);
- free (cipherInts);
+ PianoFree (plainInts, plainIntsN * sizeof (*plainInts));
+ PianoFree (cipherInts, plainIntsN * sizeof (*cipherInts));
return strHex;
}