summaryrefslogtreecommitdiff
path: root/src/gtm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtm')
-rw-r--r--src/gtm/proxy/proxy_main.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gtm/proxy/proxy_main.c b/src/gtm/proxy/proxy_main.c
index 871280fa89..e03e3e8b34 100644
--- a/src/gtm/proxy/proxy_main.c
+++ b/src/gtm/proxy/proxy_main.c
@@ -2441,6 +2441,14 @@ GTMProxy_ProcessPendingCommands(GTMProxy_ThreadInfo *thrinfo)
*/
thrinfo->thr_processed_commands = gtm_list_concat(thrinfo->thr_processed_commands,
thrinfo->thr_pending_commands[ii]);
+ /*
+ * Free the list header of the second list, unless
+ * gtm_list_concat actually returned the second list as-is
+ * because the first list was empty
+ */
+ if ((thrinfo->thr_processed_commands != thrinfo->thr_pending_commands[ii]) &&
+ (thrinfo->thr_pending_commands[ii] != gtm_NIL))
+ pfree(thrinfo->thr_pending_commands[ii]);
thrinfo->thr_pending_commands[ii] = gtm_NIL;
break;
@@ -2472,6 +2480,14 @@ GTMProxy_ProcessPendingCommands(GTMProxy_ThreadInfo *thrinfo)
*/
thrinfo->thr_processed_commands = gtm_list_concat(thrinfo->thr_processed_commands,
thrinfo->thr_pending_commands[ii]);
+ /*
+ * Free the list header of the second list, unless
+ * gtm_list_concat actually returned the second list as-is
+ * because the first list was empty
+ */
+ if ((thrinfo->thr_processed_commands != thrinfo->thr_pending_commands[ii]) &&
+ (thrinfo->thr_pending_commands[ii] != gtm_NIL))
+ pfree(thrinfo->thr_pending_commands[ii]);
thrinfo->thr_pending_commands[ii] = gtm_NIL;
break;
@@ -2506,6 +2522,14 @@ GTMProxy_ProcessPendingCommands(GTMProxy_ThreadInfo *thrinfo)
*/
thrinfo->thr_processed_commands = gtm_list_concat(thrinfo->thr_processed_commands,
thrinfo->thr_pending_commands[ii]);
+ /*
+ * Free the list header of the second list, unless
+ * gtm_list_concat actually returned the second list as-is
+ * because the first list was empty
+ */
+ if ((thrinfo->thr_processed_commands != thrinfo->thr_pending_commands[ii]) &&
+ (thrinfo->thr_pending_commands[ii] != gtm_NIL))
+ pfree(thrinfo->thr_pending_commands[ii]);
thrinfo->thr_pending_commands[ii] = gtm_NIL;
break;
@@ -2537,6 +2561,14 @@ GTMProxy_ProcessPendingCommands(GTMProxy_ThreadInfo *thrinfo)
*/
thrinfo->thr_processed_commands = gtm_list_concat(thrinfo->thr_processed_commands,
thrinfo->thr_pending_commands[ii]);
+ /*
+ * Free the list header of the second list, unless
+ * gtm_list_concat actually returned the second list as-is
+ * because the first list was empty
+ */
+ if ((thrinfo->thr_processed_commands != thrinfo->thr_pending_commands[ii]) &&
+ (thrinfo->thr_pending_commands[ii] != gtm_NIL))
+ pfree(thrinfo->thr_pending_commands[ii]);
thrinfo->thr_pending_commands[ii] = gtm_NIL;
break;