Skip to content

Commit cf1284d

Browse files
committed
Some minor modifications.
1 parent 753d043 commit cf1284d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

xdl/src/main/cpp/xdl.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static int xdl_find_iterate_cb(struct dl_phdr_info *info, size_t size, void *arg
452452

453453
// found the target ELF
454454
if (NULL == ((*self) = calloc(1, sizeof(xdl_t)))) return 1; // return failed
455-
if (NULL == ((*self)->pathname = strdup(info->dlpi_name))) {
455+
if (NULL == ((*self)->pathname = strdup((const char *)info->dlpi_name))) {
456456
free(*self);
457457
*self = NULL;
458458
return 1; // return failed
@@ -741,10 +741,12 @@ static int xdl_open_by_addr_iterate_cb(struct dl_phdr_info *info, size_t size, v
741741
xdl_t **self = (xdl_t **)*pkg++;
742742
uintptr_t addr = *pkg;
743743

744+
if (0 == info->dlpi_addr || NULL == info->dlpi_name) return 0; // continue
745+
744746
if (xdl_elf_is_match(info->dlpi_addr, info->dlpi_phdr, info->dlpi_phnum, addr)) {
745747
// found the target ELF
746748
if (NULL == ((*self) = calloc(1, sizeof(xdl_t)))) return 1; // failed
747-
if (NULL == ((*self)->pathname = strdup(info->dlpi_name))) {
749+
if (NULL == ((*self)->pathname = strdup((const char *)info->dlpi_name))) {
748750
free(*self);
749751
*self = NULL;
750752
return 1; // failed
@@ -757,7 +759,7 @@ static int xdl_open_by_addr_iterate_cb(struct dl_phdr_info *info, size_t size, v
757759
return 1; // OK
758760
}
759761

760-
return 0; // mismatch
762+
return 0; // continue
761763
}
762764

763765
static void *xdl_open_by_addr(void *addr) {

xdl/src/main/cpp/xdl_lzma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static xdl_lzma_free_t xdl_lzma_free = NULL;
8686
static void *xdl_lzma_code = NULL;
8787

8888
// LZMA init
89-
static void xdl_lzma_init() {
89+
static void xdl_lzma_init(void) {
9090
void *lzma = xdl_open(XDL_LZMA_PATHNAME, XDL_TRY_FORCE_LOAD);
9191
if (NULL == lzma) return;
9292

0 commit comments

Comments
 (0)