Re: [QUESTION]



On 2010-08-25, parjit <nospam@xxxxxxxxxx> wrote:
Seebs wrote:
Not at all. Try putting the question into words, such as:
If I allocate something in a function, and return the pointer,
and free
it in another function, does that create a memory leak?

That would allow people to be more sure of what you were trying to do.

Actually my question was not from a negative experience, but as a result
of a discussion with someone. I argued that tho it was a bad programming
practice, it didn't necessarily create a memory leak by virtue of its
syntax. I'm still not sure if I was right or not.

I don't see what you think is a bad programming practice.

EXPLAIN your question, don't just expect us to guess it from your
sample program. What was the discussion? What do you think is "bad"
about it? What on earth do you mean by "by virtue of its syntax"? Syntax
is not what creates memory leaks. And there is no memory leak in that
code.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam@xxxxxxxxx
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
.