diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_print.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_print.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c index c7c407e494..e2cab2497f 100644 --- a/src/lib/libcrypto/bn/bn_print.c +++ b/src/lib/libcrypto/bn/bn_print.c | |||
@@ -64,14 +64,14 @@ | |||
64 | 64 | ||
65 | static const char Hex[]="0123456789ABCDEF"; | 65 | static const char Hex[]="0123456789ABCDEF"; |
66 | 66 | ||
67 | /* Must 'OPENSSL_free' the returned data */ | 67 | /* Must 'free' the returned data */ |
68 | char *BN_bn2hex(const BIGNUM *a) | 68 | char *BN_bn2hex(const BIGNUM *a) |
69 | { | 69 | { |
70 | int i,j,v,z=0; | 70 | int i,j,v,z=0; |
71 | char *buf; | 71 | char *buf; |
72 | char *p; | 72 | char *p; |
73 | 73 | ||
74 | buf=(char *)OPENSSL_malloc(a->top*BN_BYTES*2+2); | 74 | buf=(char *)malloc(a->top*BN_BYTES*2+2); |
75 | if (buf == NULL) | 75 | if (buf == NULL) |
76 | { | 76 | { |
77 | BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE); | 77 | BNerr(BN_F_BN_BN2HEX,ERR_R_MALLOC_FAILURE); |
@@ -99,7 +99,7 @@ err: | |||
99 | return(buf); | 99 | return(buf); |
100 | } | 100 | } |
101 | 101 | ||
102 | /* Must 'OPENSSL_free' the returned data */ | 102 | /* Must 'free' the returned data */ |
103 | char *BN_bn2dec(const BIGNUM *a) | 103 | char *BN_bn2dec(const BIGNUM *a) |
104 | { | 104 | { |
105 | int i=0,num, ok = 0; | 105 | int i=0,num, ok = 0; |
@@ -115,8 +115,8 @@ char *BN_bn2dec(const BIGNUM *a) | |||
115 | */ | 115 | */ |
116 | i=BN_num_bits(a)*3; | 116 | i=BN_num_bits(a)*3; |
117 | num=(i/10+i/1000+1)+1; | 117 | num=(i/10+i/1000+1)+1; |
118 | bn_data=(BN_ULONG *)OPENSSL_malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG)); | 118 | bn_data=(BN_ULONG *)malloc((num/BN_DEC_NUM+1)*sizeof(BN_ULONG)); |
119 | buf=(char *)OPENSSL_malloc(num+3); | 119 | buf=(char *)malloc(num+3); |
120 | if ((buf == NULL) || (bn_data == NULL)) | 120 | if ((buf == NULL) || (bn_data == NULL)) |
121 | { | 121 | { |
122 | BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE); | 122 | BNerr(BN_F_BN_BN2DEC,ERR_R_MALLOC_FAILURE); |
@@ -158,11 +158,11 @@ char *BN_bn2dec(const BIGNUM *a) | |||
158 | } | 158 | } |
159 | ok = 1; | 159 | ok = 1; |
160 | err: | 160 | err: |
161 | if (bn_data != NULL) OPENSSL_free(bn_data); | 161 | if (bn_data != NULL) free(bn_data); |
162 | if (t != NULL) BN_free(t); | 162 | if (t != NULL) BN_free(t); |
163 | if (!ok && buf) | 163 | if (!ok && buf) |
164 | { | 164 | { |
165 | OPENSSL_free(buf); | 165 | free(buf); |
166 | buf = NULL; | 166 | buf = NULL; |
167 | } | 167 | } |
168 | 168 | ||