Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10829, freeing of uninitialized pointer #10832

Merged
merged 1 commit into from
Apr 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/dlload.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,10 @@ DLLEXPORT int jl_uv_dlopen(const char *filename, jl_uv_libhandle lib_, unsigned
#endif
);
if (lib->handle) {
if (lib->errmsg)
free(lib->errmsg);
lib->errmsg = NULL;
return 0;
}
else {
if (lib->errmsg)
free(lib->errmsg);
lib->errmsg = strdup(dlerror());
return -1;
}
Expand Down Expand Up @@ -124,6 +120,10 @@ static uv_lib_t *jl_load_dynamic_library_(const char *modname, unsigned flags, i
snprintf(path, PATHBUF, "%s%s%s", dl_path, modname, ext);
else
snprintf(path, PATHBUF, "%s" PATHSEPSTRING "%s%s", dl_path, modname, ext);
if (handle->errmsg) {
free(handle->errmsg);
handle->errmsg = NULL;
}
error = jl_uv_dlopen(path, handle, flags);
if (!error) goto done;
}
Expand All @@ -136,13 +136,21 @@ static uv_lib_t *jl_load_dynamic_library_(const char *modname, unsigned flags, i
handle->handle = NULL;
/* try loading from standard library path */
snprintf(path, PATHBUF, "%s%s", modname, ext);
if (handle->errmsg) {
free(handle->errmsg);
handle->errmsg = NULL;
}
error = jl_uv_dlopen(path, handle, flags);
if (!error) goto done;
}

#if defined(__linux__) || defined(__FreeBSD__)
{
const char *soname = jl_lookup_soname(modname, strlen(modname));
if (handle->errmsg) {
free(handle->errmsg);
handle->errmsg = NULL;
}
error = (soname==NULL) || jl_uv_dlopen(soname, handle, flags);
if (!error) goto done;
}
Expand Down