소스 검색

tmx: check for empty result not to allocate 0 bytes

- allocation of 0 size is undefined when using system malloc
Daniel-Constantin Mierla 10 년 전
부모
커밋
0db313f004
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      modules/tmx/t_mi.c

+ 4 - 0
modules/tmx/t_mi.c

@@ -228,6 +228,10 @@ static inline char *get_hfblock( str *uri, struct hdr_field *hf, int *l, struct
 		LM_DBG("one more hf processed\n");
 	} /* header loop */
 
+	if(total_len==0) {
+		LM_DBG("empty result\n");
+		goto error;
+	}
 
 	/* construct a single header block now */
 	ret=pkg_malloc(total_len);