Skip to content

Commit fc7b3ef

Browse files
committed
Fixed valgrind complain
1 parent 86e0455 commit fc7b3ef

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

standalone/api.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ apr_status_t ap_http_out_filter(ap_filter_t *f, apr_bucket_brigade *b) {
216216
}
217217

218218
void modsecTerminate() {
219+
apr_pool_destroy(pool);
220+
pool = NULL;
219221
apr_terminate();
220222
}
221223

@@ -267,7 +269,7 @@ conn_rec *modsecNewConnection() {
267269

268270
apr_pool_create(&pc, pool);
269271

270-
c = apr_palloc(pc, sizeof(conn_rec));
272+
c = apr_pcalloc(pc, sizeof(conn_rec));
271273

272274
c->base_server = server;
273275
c->id = 1;
@@ -300,7 +302,7 @@ request_rec *modsecNewRequest(conn_rec *connection, directory_config *config)
300302

301303
apr_pool_create(&pr, connection->pool);
302304

303-
r = apr_palloc(pr, sizeof(request_rec));
305+
r = apr_pcalloc(pr, sizeof(request_rec));
304306

305307
r->connection = connection;
306308
r->server = server;

standalone/server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,7 @@ AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex)
992992
#endif
993993
union semun ick;
994994
struct semid_ds buf;
995+
memset(&buf,0,sizeof(buf));
995996

996997
apr_os_proc_mutex_get(&ospmutex, pmutex);
997998
buf.sem_perm.uid = unixd_config.user_id;

0 commit comments

Comments
 (0)