Quellcode durchsuchen

acc: cdr - do not free static empty string in case of error

Daniel-Constantin Mierla vor 1 Jahr
Ursprung
Commit
0fc0cdd791
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      src/modules/acc/acc_cdr.c

+ 2 - 2
src/modules/acc/acc_cdr.c

@@ -113,10 +113,10 @@ int cdr_core2strar(struct dlg_cell *dlg, str *values, int *unused, char *types)
 				/* cleanup already allocated memory and
 				/* cleanup already allocated memory and
 				 * return that we didn't do anything */
 				 * return that we didn't do anything */
 				for(i = i - 1; i >= 0; i--) {
 				for(i = i - 1; i >= 0; i--) {
-					if(NULL != values[i].s) {
+					if(NULL != values[i].s && types[i] != TYPE_NULL) {
 						pkg_free(values[i].s);
 						pkg_free(values[i].s);
-						values[i].s = NULL;
 					}
 					}
+					values[i].s = NULL;
 				}
 				}
 				return 0;
 				return 0;
 			}
 			}