ソースを参照

lost: condition only on str pointer to free it

- cover empty strings

(cherry picked from commit 6b1008610861be62bd1b5f419f2cdd9bd2b23ffc)
Daniel-Constantin Mierla 5 ヶ月 前
コミット
a8d291951b
2 ファイル変更3 行追加4 行削除
  1. 2 3
      src/modules/lost/response.c
  2. 1 1
      src/modules/lost/utilities.c

+ 2 - 3
src/modules/lost/response.c

@@ -839,10 +839,9 @@ p_lost_info_t lost_get_response_info(
 		} else {
 			tmp.s = lost_get_content(node, name, &tmp.len);
 		}
-		if(tmp.len > 0 && tmp.s != NULL) {
+		if(tmp.s != NULL) {
 			res->text = lost_copy_string(tmp, &len);
-			if(len > 0) {
-
+			if(res->text != NULL) {
 				LM_DBG("###\t\t[%s]\n", res->text);
 			}
 			lost_free_string(&tmp); /* clean up */

+ 1 - 1
src/modules/lost/utilities.c

@@ -310,7 +310,7 @@ void lost_free_string(str *string)
 
 	ptr = *string;
 
-	if(ptr.s != NULL && ptr.len > 0) {
+	if(ptr.s != NULL) {
 		pkg_free(ptr.s);
 
 		LM_DBG("### string object removed\n");