From bddb7c686e3d1aeb156722adc64b6c35ae720f87 Mon Sep 17 00:00:00 2001 From: beck <> Date: Thu, 17 Apr 2014 13:37:50 +0000 Subject: 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 --- src/lib/libcrypto/dso/dso.h | 10 +++++----- src/lib/libcrypto/dso/dso_dlfcn.c | 10 +++++----- src/lib/libcrypto/dso/dso_lib.c | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/lib/libcrypto/dso') diff --git a/src/lib/libcrypto/dso/dso.h b/src/lib/libcrypto/dso/dso.h index f36f209afd..9010251bbc 100644 --- a/src/lib/libcrypto/dso/dso.h +++ b/src/lib/libcrypto/dso/dso.h @@ -112,7 +112,7 @@ typedef struct dso_st DSO; * (or NULL if they are to be used independantly of a DSO object) and a * filename to transform. They should either return NULL (if there is an error * condition) or a newly allocated string containing the transformed form that - * the caller will need to free with OPENSSL_free() when done. */ + * the caller will need to free with free() when done. */ typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); /* The function prototype used for method functions (or caller-provided * callbacks) that merge two file specifications. They are passed a @@ -120,7 +120,7 @@ typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); * a DSO object) and two file specifications to merge. They should * either return NULL (if there is an error condition) or a newly allocated * string containing the result of merging that the caller will need - * to free with OPENSSL_free() when done. + * to free with free() when done. * Here, merging means that bits and pieces are taken from each of the * file specifications and added together in whatever fashion that is * sensible for the DSO method in question. The only rule that really @@ -136,7 +136,7 @@ typedef struct dso_meth_st const char *name; /* Loads a shared library, NB: new DSO_METHODs must ensure that a * successful load populates the loaded_filename field, and likewise a - * successful unload OPENSSL_frees and NULLs it out. */ + * successful unload frees and NULLs it out. */ int (*dso_load)(DSO *dso); /* Unloads a shared library */ int (*dso_unload)(DSO *dso); @@ -242,12 +242,12 @@ int DSO_set_filename(DSO *dso, const char *filename); * simply duplicated. NB: This function is usually called from within a * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that * caller-created DSO_METHODs can do the same thing. A non-NULL return value - * will need to be OPENSSL_free()'d. */ + * will need to be free()'d. */ char *DSO_convert_filename(DSO *dso, const char *filename); /* This function will invoke the DSO's merger callback to merge two file * specifications, or if the callback isn't set it will instead use the * DSO_METHOD's merger. A non-NULL return value will need to be - * OPENSSL_free()'d. */ + * free()'d. */ char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); /* If the DSO is currently loaded, this returns the filename that it was loaded * under, otherwise it returns NULL. So it is also useful as a test as to diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c index fe5f0ffdb0..648ddb5ac0 100644 --- a/src/lib/libcrypto/dso/dso_dlfcn.c +++ b/src/lib/libcrypto/dso/dso_dlfcn.c @@ -153,7 +153,7 @@ static int dlfcn_load(DSO *dso) err: /* Cleanup! */ if(filename != NULL) - OPENSSL_free(filename); + free(filename); if(ptr != NULL) dlclose(ptr); return(0); @@ -264,7 +264,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) { len = strlen(filespec1) + 1; - merged = OPENSSL_malloc(len); + merged = malloc(len); if(!merged) { DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); @@ -276,7 +276,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, else if (!filespec1) { len = strlen(filespec2) + 1; - merged = OPENSSL_malloc(strlen(filespec2) + 1); + merged = malloc(strlen(filespec2) + 1); if(!merged) { DSOerr(DSO_F_DLFCN_MERGER, @@ -302,7 +302,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1, spec2len--; len--; } - merged = OPENSSL_malloc(len + 2); + merged = malloc(len + 2); if(!merged) { DSOerr(DSO_F_DLFCN_MERGER, @@ -334,7 +334,7 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename) if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) rsize += 3; /* The length of "lib" */ } - translated = OPENSSL_malloc(rsize); + translated = malloc(rsize); if(translated == NULL) { DSOerr(DSO_F_DLFCN_NAME_CONVERTER, diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c index 8a15b794ab..68f5430ea8 100644 --- a/src/lib/libcrypto/dso/dso_lib.c +++ b/src/lib/libcrypto/dso/dso_lib.c @@ -100,7 +100,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) * to stealing the "best available" method. Will fallback * to DSO_METH_null() in the worst case. */ default_DSO_meth = DSO_METHOD_openssl(); - ret = (DSO *)OPENSSL_malloc(sizeof(DSO)); + ret = (DSO *)malloc(sizeof(DSO)); if(ret == NULL) { DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); @@ -112,7 +112,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) { /* sk_new doesn't generate any errors so we do */ DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); - OPENSSL_free(ret); + free(ret); return(NULL); } if(meth == NULL) @@ -122,7 +122,7 @@ DSO *DSO_new_method(DSO_METHOD *meth) ret->references = 1; if((ret->meth->init != NULL) && !ret->meth->init(ret)) { - OPENSSL_free(ret); + free(ret); ret=NULL; } return(ret); @@ -165,11 +165,11 @@ int DSO_free(DSO *dso) sk_void_free(dso->meth_data); if(dso->filename != NULL) - OPENSSL_free(dso->filename); + free(dso->filename); if(dso->loaded_filename != NULL) - OPENSSL_free(dso->loaded_filename); + free(dso->loaded_filename); - OPENSSL_free(dso); + free(dso); return(1); } @@ -377,7 +377,7 @@ int DSO_set_filename(DSO *dso, const char *filename) return(0); } /* We'll duplicate filename */ - copied = OPENSSL_malloc(strlen(filename) + 1); + copied = malloc(strlen(filename) + 1); if(copied == NULL) { DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE); @@ -385,7 +385,7 @@ int DSO_set_filename(DSO *dso, const char *filename) } BUF_strlcpy(copied, filename, strlen(filename) + 1); if(dso->filename) - OPENSSL_free(dso->filename); + free(dso->filename); dso->filename = copied; return(1); } @@ -435,7 +435,7 @@ char *DSO_convert_filename(DSO *dso, const char *filename) } if(result == NULL) { - result = OPENSSL_malloc(strlen(filename) + 1); + result = malloc(strlen(filename) + 1); if(result == NULL) { DSOerr(DSO_F_DSO_CONVERT_FILENAME, -- cgit v1.2.3-55-g6feb