changeset 166:c7ea70dea191 libavutil

memleak
author michael
date Sun, 14 Jan 2007 09:25:52 +0000
parents d64f200afe17
children 6104bbdb757b
files aes.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/aes.c	Sun Jan 14 09:14:05 2007 +0000
+++ b/aes.c	Sun Jan 14 09:25:52 2007 +0000
@@ -105,7 +105,7 @@
 
 // this is based on the reference AES code by Paulo Barreto and Vincent Rijmen
 AVAES *av_aes_init(uint8_t *key, int keyBits) {
-    AVAES *a= av_malloc(sizeof(AVAES));
+    AVAES *a;
     int i, j, t, rconpointer = 0;
     uint8_t tk[8][4];
     int KC= keyBits/32;
@@ -131,11 +131,12 @@
         }
     }
 
-    a->rounds= ROUNDS;
-
     if(keyBits!=128 && keyBits!=192 && keyBits!=256)
         return NULL;
 
+    a= av_malloc(sizeof(AVAES));
+    a->rounds= ROUNDS;
+
     memcpy(tk, key, KC*4);
 
     for(t= 0; t < (ROUNDS+1)*4; ) {