- {
- DSO *ret;
- int allocated = 0;
-
- if(dso == NULL)
- {
- ret = DSO_new_method(meth);
- if(ret == NULL)
- {
- DSOerr(DSO_F_DSO_LOAD,ERR_R_MALLOC_FAILURE);
- goto err;
- }
- allocated = 1;
- /* Pass the provided flags to the new DSO object */
- if(DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0)
- {
- DSOerr(DSO_F_DSO_LOAD,DSO_R_CTRL_FAILED);
- goto err;
- }
- }
- else
- ret = dso;
- /* Don't load if we're currently already loaded */
- if(ret->filename != NULL)
- {
- DSOerr(DSO_F_DSO_LOAD,DSO_R_DSO_ALREADY_LOADED);
- goto err;
- }
- /* filename can only be NULL if we were passed a dso that already has
- * one set. */
- if(filename != NULL)
- if(!DSO_set_filename(ret, filename))
- {
- DSOerr(DSO_F_DSO_LOAD,DSO_R_SET_FILENAME_FAILED);
- goto err;
- }
- filename = ret->filename;
- if(filename == NULL)
- {
- DSOerr(DSO_F_DSO_LOAD,DSO_R_NO_FILENAME);
- goto err;
- }
- if(ret->meth->dso_load == NULL)
- {
- DSOerr(DSO_F_DSO_LOAD,DSO_R_UNSUPPORTED);
- goto err;
- }
- if(!ret->meth->dso_load(ret))
- {
- DSOerr(DSO_F_DSO_LOAD,DSO_R_LOAD_FAILED);
- goto err;
- }
- /* Load succeeded */
- return(ret);
-err:
- if(allocated)
- DSO_free(ret);
- return(NULL);
- }
+{
+ DSO *ret;
+ int allocated = 0;
+
+ if (dso == NULL) {
+ ret = DSO_new_method(meth);
+ if (ret == NULL) {
+ DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ allocated = 1;
+ /* Pass the provided flags to the new DSO object */
+ if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) {
+ DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED);
+ goto err;
+ }
+ } else
+ ret = dso;
+ /* Don't load if we're currently already loaded */
+ if (ret->filename != NULL) {
+ DSOerr(DSO_F_DSO_LOAD, DSO_R_DSO_ALREADY_LOADED);
+ goto err;
+ }
+ /*
+ * filename can only be NULL if we were passed a dso that already has one
+ * set.
+ */
+ if (filename != NULL)
+ if (!DSO_set_filename(ret, filename)) {
+ DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED);
+ goto err;
+ }
+ filename = ret->filename;
+ if (filename == NULL) {
+ DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME);
+ goto err;
+ }
+ if (ret->meth->dso_load == NULL) {
+ DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED);
+ goto err;
+ }
+ if (!ret->meth->dso_load(ret)) {
+ DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED);
+ goto err;
+ }
+ /* Load succeeded */
+ return (ret);
+ err:
+ if (allocated)
+ DSO_free(ret);
+ return (NULL);
+}