[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible memory leak in lowercase() function


Keisial wrote:
Dmitry V. Krivenok escribió:
Hello!

I fixed a bug in lowercase().
Patch is attached.

This wasn't a memory leak, but a potential crash. Some (most?) strdup()
implementations segfault when calling strdup(NULL);

Hello!

Yes, you are right. It's a potential crash.
Indeed, memory leak it really unlikely it such a case.

However, man 3 strdup says nothing about passing NULL as argument
to strdup, so it's undefined behavior.

Anyway str should be checked _before_ calling strdup.

--
Sincerely yours, Dmitry V. Krivenok
Orange System Co., Ltd.
Saint-Petersburg, Russia
work phone: +7 812 332-32-40
cellular phone: +7 921 576-70-91
e-mail: krivenok@xxxxxxxxxxxxxxx
web: http://www.orangesystem.ru
skype: krivenok_dmitry
jabber: krivenok_dmitry@xxxxxxxxx
icq: 242-526-443


Follow-Ups:
Re: Possible memory leak in lowercase() functionAndreas Schneider <mail@xxxxxxxxxxxx>
References:
Possible memory leak in lowercase() function"Dmitry V. Krivenok" <krivenok@xxxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org