Quellcode durchsuchen

modules/dialog_ng: bug fix for concurrent dialog did generation
- spotted by Camille @ Orange - tks!

Jason Penton vor 12 Jahren
Ursprung
Commit
9e7f627c5e
1 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen
  1. 4 3
      modules/dialog_ng/dlg_hash.c

+ 4 - 3
modules/dialog_ng/dlg_hash.c

@@ -1268,12 +1268,13 @@ int dlg_set_toroute(struct dlg_cell *dlg, str * route) {
  */
  */
 void create_concurrent_did(struct dlg_cell *dlg, str * new_did) {
 void create_concurrent_did(struct dlg_cell *dlg, str * new_did) {
     int len  = dlg->did.len + 1;
     int len  = dlg->did.len + 1;
-    new_did = shm_malloc(len);
-    if (new_did == 0) {
+    new_did->s = shm_malloc(len);
+    if (new_did->s == 0) {
         LM_ERR("no more shm mem (%d)\n", len);
         LM_ERR("no more shm mem (%d)\n", len);
+        return;
     }
     }
     memcpy(new_did->s, dlg->did.s, dlg->did.len);
     memcpy(new_did->s, dlg->did.s, dlg->did.len);
-    new_did->s[dlg->did.len+1]= 'x';
+    new_did->s[len]= 'x';
     new_did->len = len;
     new_did->len = len;
 }
 }