|
@@ -366,11 +366,14 @@ __map_elf_object (struct shim_handle * file,
|
|
|
if (file && (!read || !mmap || !seek))
|
|
|
return NULL;
|
|
|
|
|
|
- struct link_map * l = remap ? :
|
|
|
+ struct link_map * l = remap ? remap :
|
|
|
new_elf_object(file ? (!qstrempty(&file->path) ?
|
|
|
qstrgetstr(&file->path) :
|
|
|
qstrgetstr(&file->uri)) : "", type);
|
|
|
|
|
|
+ if (!l)
|
|
|
+ return NULL;
|
|
|
+
|
|
|
const char * errstring __attribute__((unused)) = NULL;
|
|
|
int errval = 0;
|
|
|
int ret;
|
|
@@ -378,9 +381,7 @@ __map_elf_object (struct shim_handle * file,
|
|
|
if (type != OBJECT_INTERNAL && !file) {
|
|
|
errstring = "shared object has to be backed by file";
|
|
|
errval = -EINVAL;
|
|
|
-call_lose:
|
|
|
- debug("loading %s: %s\n", l->l_name, errstring);
|
|
|
- return NULL;
|
|
|
+ goto call_lose;
|
|
|
}
|
|
|
|
|
|
/* Scan the program header table, collecting its load commands. */
|
|
@@ -728,6 +729,14 @@ postmap:
|
|
|
setup_elf_hash(l);
|
|
|
|
|
|
return l;
|
|
|
+
|
|
|
+call_lose:
|
|
|
+ debug("loading %s: %s\n", l->l_name, errstring);
|
|
|
+ if (l != remap) {
|
|
|
+ /* l was allocated via new_elf_object() */
|
|
|
+ free(l);
|
|
|
+ }
|
|
|
+ return NULL;
|
|
|
}
|
|
|
|
|
|
static inline
|