]> git.sesse.net Git - ffmpeg/commitdiff
memleak
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 14 Jan 2007 09:25:52 +0000 (09:25 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 14 Jan 2007 09:25:52 +0000 (09:25 +0000)
Originally committed as revision 7462 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/aes.c

index 07485167b8a59ac13c8b7be689f01b0979b85e02..7dc4bad5ca14d6e491ee183843ab8c9c5e19f790 100644 (file)
@@ -105,7 +105,7 @@ void av_aes_encrypt(AVAES *a){
 
 // 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 @@ AVAES *av_aes_init(uint8_t *key, int keyBits) {
         }
     }
 
-    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; ) {