You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
fix: checking malloc against non NULL not NULL
This commit fixes an issue where one of the "malloc", a libc function to allocate dynamic memory, "if"s were checking its return against non-NULL instead of NULL, making it seem to have failed when it didn't.
This commit is contained in:
@@ -270,13 +270,13 @@ struct SocketHandler : public EventHandler {
|
|||||||
LOGD("received daemon64 info %s", msg->data);
|
LOGD("received daemon64 info %s", msg->data);
|
||||||
|
|
||||||
/* Will only happen if somehow the daemon restarts */
|
/* Will only happen if somehow the daemon restarts */
|
||||||
if (status64.daemon_info != NULL) {
|
if (status64.daemon_info) {
|
||||||
free(status64.daemon_info);
|
free(status64.daemon_info);
|
||||||
status64.daemon_info = NULL;
|
status64.daemon_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status64.daemon_info = (char *)malloc(msg->length);
|
status64.daemon_info = (char *)malloc(msg->length);
|
||||||
if (status64.daemon_info == NULL) {
|
if (!status64.daemon_info) {
|
||||||
PLOGE("malloc daemon64 info");
|
PLOGE("malloc daemon64 info");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -291,13 +291,13 @@ struct SocketHandler : public EventHandler {
|
|||||||
case DAEMON32_SET_INFO: {
|
case DAEMON32_SET_INFO: {
|
||||||
LOGD("received daemon32 info %s", msg->data);
|
LOGD("received daemon32 info %s", msg->data);
|
||||||
|
|
||||||
if (status32.daemon_info != NULL) {
|
if (status32.daemon_info) {
|
||||||
free(status32.daemon_info);
|
free(status32.daemon_info);
|
||||||
status32.daemon_info = NULL;
|
status32.daemon_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status32.daemon_info = (char *)malloc(msg->length);
|
status32.daemon_info = (char *)malloc(msg->length);
|
||||||
if (status32.daemon_info == NULL) {
|
if (!status32.daemon_info) {
|
||||||
PLOGE("malloc daemon32 info");
|
PLOGE("malloc daemon32 info");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -314,13 +314,13 @@ struct SocketHandler : public EventHandler {
|
|||||||
|
|
||||||
status64.daemon_running = false;
|
status64.daemon_running = false;
|
||||||
|
|
||||||
if (status64.daemon_error_info != NULL) {
|
if (status64.daemon_error_info) {
|
||||||
free(status64.daemon_error_info);
|
free(status64.daemon_error_info);
|
||||||
status64.daemon_error_info = NULL;
|
status64.daemon_error_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status64.daemon_error_info = (char *)malloc(msg->length);
|
status64.daemon_error_info = (char *)malloc(msg->length);
|
||||||
if (status64.daemon_error_info == NULL) {
|
if (!status64.daemon_error_info) {
|
||||||
PLOGE("malloc daemon64 error info");
|
PLOGE("malloc daemon64 error info");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -337,13 +337,13 @@ struct SocketHandler : public EventHandler {
|
|||||||
|
|
||||||
status32.daemon_running = false;
|
status32.daemon_running = false;
|
||||||
|
|
||||||
if (status32.daemon_error_info != NULL) {
|
if (status32.daemon_error_info) {
|
||||||
free(status32.daemon_error_info);
|
free(status32.daemon_error_info);
|
||||||
status32.daemon_error_info = NULL;
|
status32.daemon_error_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status32.daemon_error_info = (char *)malloc(msg->length);
|
status32.daemon_error_info = (char *)malloc(msg->length);
|
||||||
if (status32.daemon_error_info == NULL) {
|
if (!status32.daemon_error_info) {
|
||||||
PLOGE("malloc daemon32 error info");
|
PLOGE("malloc daemon32 error info");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -447,7 +447,7 @@ static bool ensure_daemon_created(bool is_64bit) {
|
|||||||
\
|
\
|
||||||
if (!status##abi.daemon_error_info) { \
|
if (!status##abi.daemon_error_info) { \
|
||||||
status##abi.daemon_error_info = (char *)malloc(strlen(status_str) + 1); \
|
status##abi.daemon_error_info = (char *)malloc(strlen(status_str) + 1); \
|
||||||
if (status##abi.daemon_error_info) { \
|
if (!status##abi.daemon_error_info) { \
|
||||||
LOGE("malloc daemon" #abi " error info failed"); \
|
LOGE("malloc daemon" #abi " error info failed"); \
|
||||||
\
|
\
|
||||||
return; \
|
return; \
|
||||||
@@ -800,10 +800,10 @@ void init_monitor() {
|
|||||||
looper.RegisterHandler(ptraceHandler, EPOLLIN | EPOLLET);
|
looper.RegisterHandler(ptraceHandler, EPOLLIN | EPOLLET);
|
||||||
looper.Loop();
|
looper.Loop();
|
||||||
|
|
||||||
if (status64.daemon_info != NULL) free(status64.daemon_info);
|
if (status64.daemon_info) free(status64.daemon_info);
|
||||||
if (status64.daemon_error_info != NULL) free(status64.daemon_error_info);
|
if (status64.daemon_error_info) free(status64.daemon_error_info);
|
||||||
if (status32.daemon_info != NULL) free(status32.daemon_info);
|
if (status32.daemon_info) free(status32.daemon_info);
|
||||||
if (status32.daemon_error_info != NULL) free(status32.daemon_error_info);
|
if (status32.daemon_error_info) free(status32.daemon_error_info);
|
||||||
|
|
||||||
LOGI("exit");
|
LOGI("exit");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user