diff files/patch-src_apps_common_hiredis__libevent2.c @ 18:4a6383e57d12

Compile with coturn 4.5.1.3 (GitHub): some security patches are already included now -- "socket" Redis option is included again
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 02 Sep 2020 22:38:36 +0200
parents 9a1ee735f28f
children 735b41782ed7
line wrap: on
line diff
--- a/files/patch-src_apps_common_hiredis__libevent2.c	Sat Mar 28 18:27:46 2020 +0100
+++ b/files/patch-src_apps_common_hiredis__libevent2.c	Wed Sep 02 22:38:36 2020 +0200
@@ -1,6 +1,6 @@
---- src/apps/common/hiredis_libevent2.c.orig	2019-03-02 21:06:19 UTC
+--- src/apps/common/hiredis_libevent2.c.orig
 +++ src/apps/common/hiredis_libevent2.c
-@@ -55,6 +55,7 @@ struct redisLibeventEvents
+@@ -55,6 +55,7 @@
  	char *ip;
  	int port;
  	char *pwd;
@@ -8,7 +8,7 @@
  	int db;
  };
  
-@@ -223,12 +224,13 @@ void send_message_to_redis(redis_context_handle rch, c
+@@ -223,12 +224,13 @@
  
  ///////////////////////// Attach /////////////////////////////////
  
@@ -23,7 +23,7 @@
    char ip[256];
    if(ip0 && ip0[0])
  	  STRCPY(ip,ip0);
-@@ -239,7 +241,14 @@ redis_context_handle redisLibeventAttach(struct event_
+@@ -239,7 +241,14 @@
    if(port0>0)
  	  port=port0;
  
@@ -39,27 +39,32 @@
    if (!ac) {
    	fprintf(stderr,"Error: %s:%s\n", ac->errstr, ac->c.errstr);
    	return NULL;
-@@ -256,6 +265,11 @@ redis_context_handle redisLibeventAttach(struct event_
+@@ -256,6 +265,11 @@
    e->port = port;
    if(pwd)
- 	  e->pwd = turn_strdup(pwd);
-+  if (usocket) {
-+	  e->usocket = turn_strdup(usocket);
+ 	  e->pwd = strdup(pwd);
++  if(usocket) {
++	  e->usocket = strdup(usocket);
 +  } else {
 +	  e->usocket = NULL;
-+  }
++  }  
    e->db = db;
  
    /* Register functions to start/stop listening for events */
-@@ -277,6 +291,7 @@ redis_context_handle redisLibeventAttach(struct event_
+@@ -277,6 +291,12 @@
    		     e);
  
    if (e->rev == NULL || e->wev == NULL) {
-+	  /* XXX FIXME TBD: free e->ip, e->pwd, e->usocket */
- 	  turn_free(e, sizeof(struct redisLibeventEvents));
++          if(e->rev)
++          	    event_free(e->rev);
++          if(e->wev)
++          	    event_free(e->wev);
++          free(e->ip);
++          free(e->pwd);
+ 	  free(e);
  	  return NULL;
    }
-@@ -327,7 +342,11 @@ static void redis_reconnect(struct redisLibeventEvents
+@@ -327,7 +347,11 @@
  	  e->context = NULL;
    }