Hello,
attached a couple of patches that fixes some double free() reported by
cppcheck in lib/amqp and /proto/zeromq. Please review.
thanks,
riccardo
>From 5cf0f2a82a3529b756abfb6e2aa47225a982aa3c Mon Sep 17 00:00:00 2001
From: Riccardo Magliocchetti <[email protected]>
Date: Sun, 11 Mar 2012 19:49:55 +0100
Subject: [PATCH 2/2] proto/zeromq: remove double free
Spotted by cppcheck.
Signed-off-by: Riccardo Magliocchetti <[email protected]>
---
proto/zeromq.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/proto/zeromq.c b/proto/zeromq.c
index 64ed931..2c18629 100644
--- a/proto/zeromq.c
+++ b/proto/zeromq.c
@@ -200,7 +200,6 @@ static int uwsgi_mongrel2_tnetstring_parse(struct wsgi_request *wsgi_req, char *
wsgi_req->async_post = fopen(post_filename, "r");
if (!wsgi_req->async_post) {
uwsgi_error_open(post_filename);
- free(post_filename);
wsgi_req->do_not_log = 1;
}
async_upload += 2;
--
1.7.9.1
>From a6d4de37532afd9712223072ad1b57cfd1d36183 Mon Sep 17 00:00:00 2001
From: Riccardo Magliocchetti <[email protected]>
Date: Sun, 11 Mar 2012 19:46:18 +0100
Subject: [PATCH 1/2] lib/amqp: Avoid undefined behaviour when freeing frame
and header
Set frame and header to NULL before freeing them another time.
Spotted by cppcheck.
Signed-off-by: Riccardo Magliocchetti <[email protected]>
---
lib/amqp.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/amqp.c b/lib/amqp.c
index 10a8d59..f278d3c 100644
--- a/lib/amqp.c
+++ b/lib/amqp.c
@@ -164,7 +164,9 @@ char *uwsgi_amqp_consume(int fd, uint64_t *msgsize, char **routing_key) {
ptr = amqp_get_longlong(ptr, watermark, msgsize); if (!ptr) goto clear2;
free(frame);
+ frame = NULL;
free(header);
+ header = NULL;
char *fullbody = uwsgi_malloc(*msgsize);
char *message;
--
1.7.9.1
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi