summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-12-22 11:32:25 +0100
committerDaniel Mack <daniel@zonque.org>2015-12-22 12:56:33 +0100
commit0a78712e819f2db29809ec752bf96c2c1012a181 (patch)
treebd0a4ad99e11fc7d4f97fd855a78924138f4d1d1
parenta97b23d65a1800876a58235966f04e02f16f7f4d (diff)
socket: nullify pointers after free
A socket shouldn't be used after socket_done() returns, but follow the general guideline here and avoid dangling pointers anyway.
-rw-r--r--src/core/socket.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index fb7632dee8..d6b0c963e8 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -156,14 +156,14 @@ static void socket_done(Unit *u) {
s->tcp_congestion = mfree(s->tcp_congestion);
s->bind_to_device = mfree(s->bind_to_device);
- free(s->smack);
- free(s->smack_ip_in);
- free(s->smack_ip_out);
+ s->smack = mfree(s->smack);
+ s->smack_ip_in = mfree(s->smack_ip_in);
+ s->smack_ip_out = mfree(s->smack_ip_out);
strv_free(s->symlinks);
- free(s->user);
- free(s->group);
+ s->user = mfree(s->user);
+ s->group = mfree(s->group);
s->fdname = mfree(s->fdname);