Преглед на файлове

_inst being NULL is the same in this contect as _inst->len being 0.
Handle the latter and don't do zero-memory allocation and zero-bytes
memcpy().

Sponsored by: Sippy Software, Inc.
Debugging: mpatrol

Maxim Sobolev преди 17 години
родител
ревизия
966ec72c44
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      modules_s/usrloc/ucontact.c

+ 1 - 1
modules_s/usrloc/ucontact.c

@@ -118,7 +118,7 @@ int new_ucontact(str* _dom, str* _uid, str* aor, str* _contact, time_t _e, qvalu
 		(*_c)->received.len = 0;
 	}
 
-	if(_inst) {
+	if(_inst && _inst->len > 0) {
 		(*_c)->instance.s = (char*)shm_malloc(_inst->len);
 		if ((*_c)->instance.s == 0) {
 			LOG(L_ERR, "new_ucontact(): No memory left\n");