Diff between f5c43df669bc978a982d54f1cddcfbc484432173 and d1fbda1e15b5cdca4c15298409122b456443f1d1

Changed Files

File Additions Deletions Status
src/shared/mgmt.c +6 -3 modified

Full Patch

diff --git a/src/shared/mgmt.c b/src/shared/mgmt.c
index cf7fdcf..ca4b05f 100644
--- a/src/shared/mgmt.c
+++ b/src/shared/mgmt.c
@@ -268,6 +268,11 @@ static void read_watch_destroy(gpointer user_data)
 {
 	struct mgmt *mgmt = user_data;
 
+	if (mgmt->destroyed) {
+		g_free(mgmt);
+		return;
+	}
+
 	mgmt->read_watch = 0;
 }
 
@@ -333,10 +338,8 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
 		break;
 	}
 
-	if (mgmt->destroyed) {
-		g_free(mgmt);
+	if (mgmt->destroyed)
 		return FALSE;
-	}
 
 	return TRUE;
 }