generate_certificate_valid_date(): Use privoxy_gmtime_r()
[privoxy.git] / client-tags.c
index c8d860e..da92545 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Purpose     :  Functions related to client-specific tags.
  *
- * Copyright   :  Copyright (C) 2016 Fabian Keil <fk@fabiankeil.de>
+ * Copyright   :  Copyright (C) 2016-2017 Fabian Keil <fk@fabiankeil.de>
  *
  *                This program is free software; you can redistribute it
  *                and/or modify it under the terms of the GNU General
@@ -473,17 +473,16 @@ static void remove_tag_for_client(const char *client_address, const char *tag)
                /* Client has preceding client */
                clients_with_tags->prev->next = clients_with_tags->next;
             }
-            freez(clients_with_tags->client);
             if (clients_with_tags == requested_tags)
             {
-               /* Removing last tag */
-               freez(requested_tags);
-               clients_with_tags = requested_tags;
-            }
-            else
-            {
-               freez(clients_with_tags);
+               /*
+                * We're in the process of removing the last tag,
+                * mark the global list as empty.
+                */
+               requested_tags = NULL;
             }
+            freez(clients_with_tags->client);
+            freez(clients_with_tags);
          }
          freez(enabled_tags->name);
          freez(enabled_tags);