[6.0] 60b17ab54 Fix a small memory leak

Reza Naghibi reza at naghibi.com
Wed May 20 13:55:08 UTC 2020


commit 60b17ab541bc774e46a09247c6c0a7c7665ebb2d
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Mar 13 14:43:01 2019 +0100

    Fix a small memory leak
    
    Fix a small memory leak when failing to spawn a new thread.

diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 044e140c4..15255736a 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -462,6 +462,7 @@ pool_breed(struct pool *qp)
 	pi->qp = qp;
 
 	if (pthread_create(&tp, &tp_attr, pool_thread, pi)) {
+		FREE_OBJ(pi);
 		VSL(SLT_Debug, 0, "Create worker thread failed %d %s",
 		    errno, strerror(errno));
 		Lck_Lock(&pool_mtx);


More information about the varnish-commit mailing list