Browse code

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

Vaclav Kubart authored on 24/07/2006 11:48:11
Showing 1 changed files
... ...
@@ -83,7 +83,6 @@ void get_raw_uri(str* _s)
83 83
 }
84 84
 
85 85
 
86
-
87 86
 /*
88 87
  * Make a copy of a str structure using shm_malloc
89 88
  */
... ...
@@ -430,6 +429,11 @@ static inline int response2dlg(struct sip_msg* _m, dlg_t* _d)
430 429
 	}
431 430
 	
432 431
 	if (get_contact_uri(_m, &contact) < 0) return -2;
432
+	if (_d->rem_target.s) {
433
+		shm_free(_d->rem_target.s);
434
+		_d->rem_target.s = 0; 
435
+		_d->rem_target.len = 0;
436
+	}
433 437
 	if (contact.len && str_duplicate(&_d->rem_target, &contact) < 0) return -3;
434 438
 	
435 439
 	if (get_to_tag(_m, &rtag) < 0) goto err1;