This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit 6dafedb6af5b7d28b35664c3e039fab42eda9439
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Jan 29 14:37:08 2019 +0100

    ARTEMIS-2260 Prevent a null pointer dereference if unable to allocate 
memory for the
    events member of the control structure. This could also cause the broker
    to abruptly shutdown.
---
 .../src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c  | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c 
b/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
index f8a04e3..9e10c9d 100644
--- 
a/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
+++ 
b/artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.c
@@ -421,6 +421,12 @@ JNIEXPORT jobject JNICALL 
Java_org_apache_activemq_artemis_jlibaio_LibaioContext
     }
 
     struct io_event * events = (struct io_event *)malloc(sizeof(struct 
io_event) * (size_t)queueSize);
+    if (events == NULL) {
+        free(theControl);
+        free(libaioContext);
+        throwRuntimeExceptionErrorNo(env, "Can't initialize mutext (not enough 
memory for the events member): ", res);
+        return NULL;
+    }
 
     theControl->ioContext = libaioContext;
     theControl->events = events;

Reply via email to