diff mbox

[libnetfilter_queue] src: check result of malloc when creating queue

Message ID 1467531482-28941-1-git-send-email-lists@inliniac.net
State Accepted
Delegated to: Florian Westphal
Headers show

Commit Message

Victor Julien July 3, 2016, 7:38 a.m. UTC
From: Victor Julien <victor@inliniac.net>

Signed-off-by: Victor Julien <victor@inliniac.net>
---
 src/libnetfilter_queue.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Florian Westphal July 3, 2016, 7:55 a.m. UTC | #1
lists@inliniac.net <lists@inliniac.net> wrote:
>  	qh = malloc(sizeof(*qh));
> +	if (!qh)
> +		return NULL;

Applied, thanks for spotting this.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/libnetfilter_queue.c b/src/libnetfilter_queue.c
index 5fbde5b..211a8ba 100644
--- a/src/libnetfilter_queue.c
+++ b/src/libnetfilter_queue.c
@@ -536,6 +536,8 @@  struct nfq_q_handle *nfq_create_queue(struct nfq_handle *h,
 		return NULL;
 
 	qh = malloc(sizeof(*qh));
+	if (!qh)
+		return NULL;
 
 	memset(qh, 0, sizeof(*qh));
 	qh->h = h;