<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<blockquote
cite="mid:959015FF-D6AE-47A7-97D8-B64A0E600CD0@apple.com"
type="cite"><br>
<div>
<blockquote type="cite">+void testNew11(NSUInteger dataLength) {</blockquote>
<blockquote type="cite">+ int *data = new int;</blockquote>
<blockquote type="cite">+ NSData *nsdata = [NSData
dataWithBytesNoCopy:data length:sizeof(int) freeWhenDone:1];
// expected-warning{{Memory allocated by 'new' should be
deallocated by 'delete', not
+dataWithBytesNoCopy:length:freeWhenDone:}}</blockquote>
<blockquote type="cite">+}</blockquote>
</div>
<div><br>
</div>
<div>Hm, that is rather unwieldy, but what bothers me more is that
+dataWithBytesNoCopy:length:freeWhenDone: <i>doesn't</i> free
the memory; it just takes ownership of it. I guess it's okay to
leave that as a FIXME for now, but in the long run we should say
something like "+dataWithBytesNoCopy:length:freeWhenDone: cannot
take ownership of memory allocated by 'new'." (In the "hold"
cases, most likely the user wasn't intending to free </div>
<div><br>
</div>
<div>But, this doesn't have to block the patch; you/we can fix it
post-commit.</div>
</blockquote>
Hi!<br>
<br>
Attached patch fixes this. Ok to commit?<br>
<pre class="moz-signature" cols="72">--
Anton</pre>
</body>
</html>