diff options
author | beck <> | 2014-04-17 13:37:50 +0000 |
---|---|---|
committer | beck <> | 2014-04-17 13:37:50 +0000 |
commit | bddb7c686e3d1aeb156722adc64b6c35ae720f87 (patch) | |
tree | 7595a93a27385c367802aa17ecf20f96551cf14d /src/lib/libcrypto/txt_db | |
parent | ecec66222d758996a4ff2671ca5026d9ede5ef76 (diff) | |
download | openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.gz openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.bz2 openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.zip |
Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free
Diffstat (limited to 'src/lib/libcrypto/txt_db')
-rw-r--r-- | src/lib/libcrypto/txt_db/txt_db.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libcrypto/txt_db/txt_db.c b/src/lib/libcrypto/txt_db/txt_db.c index 6f2ce3b5a4..c1e7a79a1a 100644 --- a/src/lib/libcrypto/txt_db/txt_db.c +++ b/src/lib/libcrypto/txt_db/txt_db.c | |||
@@ -84,16 +84,16 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
84 | if ((buf=BUF_MEM_new()) == NULL) goto err; | 84 | if ((buf=BUF_MEM_new()) == NULL) goto err; |
85 | if (!BUF_MEM_grow(buf,size)) goto err; | 85 | if (!BUF_MEM_grow(buf,size)) goto err; |
86 | 86 | ||
87 | if ((ret=OPENSSL_malloc(sizeof(TXT_DB))) == NULL) | 87 | if ((ret=malloc(sizeof(TXT_DB))) == NULL) |
88 | goto err; | 88 | goto err; |
89 | ret->num_fields=num; | 89 | ret->num_fields=num; |
90 | ret->index=NULL; | 90 | ret->index=NULL; |
91 | ret->qual=NULL; | 91 | ret->qual=NULL; |
92 | if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL) | 92 | if ((ret->data=sk_OPENSSL_PSTRING_new_null()) == NULL) |
93 | goto err; | 93 | goto err; |
94 | if ((ret->index=OPENSSL_malloc(sizeof(*ret->index)*num)) == NULL) | 94 | if ((ret->index=malloc(sizeof(*ret->index)*num)) == NULL) |
95 | goto err; | 95 | goto err; |
96 | if ((ret->qual=OPENSSL_malloc(sizeof(*(ret->qual))*num)) == NULL) | 96 | if ((ret->qual=malloc(sizeof(*(ret->qual))*num)) == NULL) |
97 | goto err; | 97 | goto err; |
98 | for (i=0; i<num; i++) | 98 | for (i=0; i<num; i++) |
99 | { | 99 | { |
@@ -123,7 +123,7 @@ TXT_DB *TXT_DB_read(BIO *in, int num) | |||
123 | else | 123 | else |
124 | { | 124 | { |
125 | buf->data[offset-1]='\0'; /* blat the '\n' */ | 125 | buf->data[offset-1]='\0'; /* blat the '\n' */ |
126 | if (!(p=OPENSSL_malloc(add+offset))) goto err; | 126 | if (!(p=malloc(add+offset))) goto err; |
127 | offset=0; | 127 | offset=0; |
128 | } | 128 | } |
129 | pp=(char **)p; | 129 | pp=(char **)p; |
@@ -178,14 +178,14 @@ err: | |||
178 | if (er) | 178 | if (er) |
179 | { | 179 | { |
180 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) | 180 | #if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16) |
181 | if (er == 1) fprintf(stderr,"OPENSSL_malloc failure\n"); | 181 | if (er == 1) fprintf(stderr,"malloc failure\n"); |
182 | #endif | 182 | #endif |
183 | if (ret != NULL) | 183 | if (ret != NULL) |
184 | { | 184 | { |
185 | if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data); | 185 | if (ret->data != NULL) sk_OPENSSL_PSTRING_free(ret->data); |
186 | if (ret->index != NULL) OPENSSL_free(ret->index); | 186 | if (ret->index != NULL) free(ret->index); |
187 | if (ret->qual != NULL) OPENSSL_free(ret->qual); | 187 | if (ret->qual != NULL) free(ret->qual); |
188 | if (ret != NULL) OPENSSL_free(ret); | 188 | if (ret != NULL) free(ret); |
189 | } | 189 | } |
190 | return(NULL); | 190 | return(NULL); |
191 | } | 191 | } |
@@ -354,10 +354,10 @@ void TXT_DB_free(TXT_DB *db) | |||
354 | { | 354 | { |
355 | for (i=db->num_fields-1; i>=0; i--) | 355 | for (i=db->num_fields-1; i>=0; i--) |
356 | if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]); | 356 | if (db->index[i] != NULL) lh_OPENSSL_STRING_free(db->index[i]); |
357 | OPENSSL_free(db->index); | 357 | free(db->index); |
358 | } | 358 | } |
359 | if (db->qual != NULL) | 359 | if (db->qual != NULL) |
360 | OPENSSL_free(db->qual); | 360 | free(db->qual); |
361 | if (db->data != NULL) | 361 | if (db->data != NULL) |
362 | { | 362 | { |
363 | for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--) | 363 | for (i=sk_OPENSSL_PSTRING_num(db->data)-1; i>=0; i--) |
@@ -369,7 +369,7 @@ void TXT_DB_free(TXT_DB *db) | |||
369 | if (max == NULL) /* new row */ | 369 | if (max == NULL) /* new row */ |
370 | { | 370 | { |
371 | for (n=0; n<db->num_fields; n++) | 371 | for (n=0; n<db->num_fields; n++) |
372 | if (p[n] != NULL) OPENSSL_free(p[n]); | 372 | if (p[n] != NULL) free(p[n]); |
373 | } | 373 | } |
374 | else | 374 | else |
375 | { | 375 | { |
@@ -377,12 +377,12 @@ void TXT_DB_free(TXT_DB *db) | |||
377 | { | 377 | { |
378 | if (((p[n] < (char *)p) || (p[n] > max)) | 378 | if (((p[n] < (char *)p) || (p[n] > max)) |
379 | && (p[n] != NULL)) | 379 | && (p[n] != NULL)) |
380 | OPENSSL_free(p[n]); | 380 | free(p[n]); |
381 | } | 381 | } |
382 | } | 382 | } |
383 | OPENSSL_free(sk_OPENSSL_PSTRING_value(db->data,i)); | 383 | free(sk_OPENSSL_PSTRING_value(db->data,i)); |
384 | } | 384 | } |
385 | sk_OPENSSL_PSTRING_free(db->data); | 385 | sk_OPENSSL_PSTRING_free(db->data); |
386 | } | 386 | } |
387 | OPENSSL_free(db); | 387 | free(db); |
388 | } | 388 | } |