summarylogtreecommitdiffstats
path: root/trousers-0.3.14-double-free.patch
blob: ef7a36a646ca655728872a48acdc77215cb17893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff -ur trousers-0.3.14/src/tspi/tsp_auth.c trousers-0.3.14-new/src/tspi/tsp_auth.c
--- trousers-0.3.14/src/tspi/tsp_auth.c	2014-07-23 12:42:45.000000000 -0700
+++ trousers-0.3.14-new/src/tspi/tsp_auth.c	2019-05-27 13:41:57.316000945 -0700
@@ -1221,7 +1221,7 @@
 	}
 
 	*handles = handle;
-    handles_track = handles;
+	handles_track = handles;
 
     // Since the call tree of this function can possibly alloc memory 
     // (check RPC_ExecuteTransport_TP function), its better to keep track of
@@ -1229,9 +1229,11 @@
 	result = obj_context_transport_execute(tspContext, TPM_ORD_Terminate_Handle, 0, NULL,
 					       NULL, &handlesLen, &handles, NULL, NULL, NULL, NULL);
 
-	free(handles);
-    handles = NULL;
-    free(handles_track);
+	if (handles != handles_track) {
+		free(handles);
+	}
+
+	free(handles_track);
 
 	return result;
 }