首页 > 系统服务 > 详细

Potential leak of memory pointed to by 'machine'

时间:2015-03-24 23:16:47      阅读:705      评论:0      收藏:0      [点我收藏+]

技术分享


Potential leak of memory pointed to by ‘machine‘

NSString * zipPath=[NSString stringWithFormat:@"{TIME=%@",[self getChuo_time]];size_t size;
   
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
   
char *machine = (char*)malloc(size);
   
sysctlbyname("hw.machine", machine, &size, NULL, 0);
   
NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];//手机型号
    free(machine);


malloc  和  free是必须配对儿使用的。要不就是内存泄漏




Potential leak of memory pointed to by 'machine'

原文:http://blog.csdn.net/u010241322/article/details/44595761

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!