Преглед изворни кода

corrected possible memory leak when refreshing a dialog from response after
refreshing it from non-initial request

Vaclav Kubart пре 19 година
родитељ
комит
40d71f4729
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      modules/tm/dlg.c

+ 5 - 1
modules/tm/dlg.c

@@ -83,7 +83,6 @@ void get_raw_uri(str* _s)
 }
 
 
-
 /*
  * Make a copy of a str structure using shm_malloc
  */
@@ -430,6 +429,11 @@ static inline int response2dlg(struct sip_msg* _m, dlg_t* _d)
 	}
 	
 	if (get_contact_uri(_m, &contact) < 0) return -2;
+	if (_d->rem_target.s) {
+		shm_free(_d->rem_target.s);
+		_d->rem_target.s = 0; 
+		_d->rem_target.len = 0;
+	}
 	if (contact.len && str_duplicate(&_d->rem_target, &contact) < 0) return -3;
 	
 	if (get_to_tag(_m, &rtag) < 0) goto err1;