此 C 代码中是否存在泄漏?
虽然答案是正确的,但只是想知道这样写是否可以:
// _mm_adds_epi16 : Adds the 8 signed 16-bit integers in a to the 8 signed
//16-bit integers in b and saturates
__m128i t7=_mm_adds_epi16( t5 ,t6 );
unsigned short *p= (unsigned short *)malloc(8);
p=(unsigned short *)&t7;
for(int i=0;i<8;i++)
{
printf("%d\n", p[i]);
}
更新
所以现在我将其更新如下:
// _mm_adds_epi16 : Adds the 8 signed 16-bit integers in a to the 8 signed
//16-bit integers in b and saturates
__m128i t7=_mm_adds_epi16( t5 ,t6 );
unsigned short *p= (unsigned short *)malloc(8);
p=(unsigned short *)&t7;
for(int i=0;i<8;i++)
{
printf("%d\n", p[i]);
}
free(p);
我还有泄漏吗?
打印t7的正确方法是什么