summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/tasn_new.c
diff options
context:
space:
mode:
authorderaadt <>2014-04-21 11:37:41 +0000
committerderaadt <>2014-04-21 11:37:41 +0000
commitf5e896baf3ba117c1daeaad1000d89331f83a90a (patch)
treead42acc3896c553cb79781bc3a1ead69a74d55a3 /src/lib/libcrypto/asn1/tasn_new.c
parente05c68b9bd2156cebb7fcf17026677fe3cacd0e7 (diff)
downloadopenbsd-f5e896baf3ba117c1daeaad1000d89331f83a90a.tar.gz
openbsd-f5e896baf3ba117c1daeaad1000d89331f83a90a.tar.bz2
openbsd-f5e896baf3ba117c1daeaad1000d89331f83a90a.zip
improve realloc/calloc/malloc patterns; ok guenther
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_new.c')
-rw-r--r--src/lib/libcrypto/asn1/tasn_new.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c
index dc9ddc413a..56c6a19cfb 100644
--- a/src/lib/libcrypto/asn1/tasn_new.c
+++ b/src/lib/libcrypto/asn1/tasn_new.c
@@ -156,10 +156,9 @@ asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
156 } 156 }
157 } 157 }
158 if (!combine) { 158 if (!combine) {
159 *pval = malloc(it->size); 159 *pval = calloc(1, it->size);
160 if (!*pval) 160 if (!*pval)
161 goto memerr; 161 goto memerr;
162 memset(*pval, 0, it->size);
163 } 162 }
164 asn1_set_choice_selector(pval, -1, it); 163 asn1_set_choice_selector(pval, -1, it);
165 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL)) 164 if (asn1_cb && !asn1_cb(ASN1_OP_NEW_POST, pval, it, NULL))
@@ -181,10 +180,9 @@ asn1_item_ex_combine_new(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
181 } 180 }
182 } 181 }
183 if (!combine) { 182 if (!combine) {
184 *pval = malloc(it->size); 183 *pval = calloc(1, it->size);
185 if (!*pval) 184 if (!*pval)
186 goto memerr; 185 goto memerr;
187 memset(*pval, 0, it->size);
188 asn1_do_lock(pval, 0, it); 186 asn1_do_lock(pval, 0, it);
189 asn1_enc_init(pval, it); 187 asn1_enc_init(pval, it);
190 } 188 }