trousers/SOURCES/trousers-0.3.14-double-free.patch

28 lines
846 B
Diff
Raw Normal View History

2019-11-05 21:28:58 +00:00
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;
}