From 68131717821ee5c946fb561218551c98e46d7d06 Mon Sep 17 00:00:00 2001
From: Yugend <jugendd@mail.ru>
Date: Tue, 19 Mar 2024 17:01:53 +0300
Subject: [PATCH] Fixed NULL checks

Reference:https://github.com/linux-audit/audit-userspace/commit/68131717821ee5c946fb561218551c98e46d7d06
Conflict:NA

---
 audisp/plugins/zos-remote/zos-remote-queue.c | 2 +-
 auparse/auparse.c                            | 1 +
 src/ausearch-lol.c                           | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/audisp/plugins/zos-remote/zos-remote-queue.c b/audisp/plugins/zos-remote/zos-remote-queue.c
index 47dd006e..f8019890 100644
--- a/audisp/plugins/zos-remote/zos-remote-queue.c
+++ b/audisp/plugins/zos-remote/zos-remote-queue.c
@@ -131,7 +131,7 @@ void increase_queue_depth(unsigned int size)
 
         tmp_q = realloc(q, size * sizeof(BerElement *));
         if (tmp_q == NULL) {
-			log_err("Memory allocation error");;
+		    log_err("Memory allocation error");;
 			pthread_mutex_unlock(&queue_lock);
 			return;
 		}
diff --git a/auparse/auparse.c b/auparse/auparse.c
index 516ee8f1..e782058d 100644
--- a/auparse/auparse.c
+++ b/auparse/auparse.c
@@ -116,6 +116,7 @@ static int setup_log_file_array(auparse_state_t *au)
 	if (!tmp) {
 		fprintf(stderr, "No memory\n");
 		aup_free_config(&config);
+		free(filename);
 		return 1;
 	}
 
diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c
index c2140b7e..7562dc21 100644
--- a/src/ausearch-lol.c
+++ b/src/ausearch-lol.c
@@ -49,6 +49,7 @@ void lol_create(lol *lo)
 	lo->array = (lolnode *)malloc(size);
 	if (lo->array == NULL) {
 		fprintf(stderr, "Memory allocation error");
+		lo->limit = 0;
 		return;
 	}
 	memset(lo->array, 0, size);
-- 
2.33.0

