]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Reduce code duplication 201/head
authorKristofer Karlsson <kristofer.karlsson@gmail.com>
Mon, 31 Dec 2012 13:02:29 +0000 (14:02 +0100)
committerKristofer Karlsson <kristofer.karlsson@gmail.com>
Mon, 31 Dec 2012 20:40:32 +0000 (21:40 +0100)
src/tcp.c

index 001c4709420f0789aaac0ec1c8817382c04307c5..a97b079bf97a547ab51efb3e3950034038f86e49 100644 (file)
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -185,16 +185,12 @@ tcp_write_queue(int fd, htsbuf_queue_t *q)
   void *p;
 
   while((hd = TAILQ_FIRST(&q->hq_q)) != NULL) {
-    TAILQ_REMOVE(&q->hq_q, hd, hd_link);
-
     if (!r) {
       l = hd->hd_data_len - hd->hd_data_off;
       p = hd->hd_data + hd->hd_data_off;
       r = tvh_write(fd, p, l);
     }
-
-    free(hd->hd_data);
-    free(hd);
+    htsbuf_data_free(q, hd);
   }
   q->hq_size = 0;
   return r;