-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 10/8/2009 4:37 AM, Konstantin Kolinko wrote:
> 2009/10/8 Mohamedin <mohame...@easy-dialog.info>:
>> Here is one function that always crash. The portion of the code that couse
>> the crash in my opinion is the if which has malloc. I noticed it crash
>> whenever it is called with the same srcFile and dstFile
>>
>> int reduce_quality(const char * srcFile, const char * dstFile, int maxSize){
>>
>> ...
>> tmpFile = (char *) malloc(sizeof(srcFile)+1);
> 
> You meant string length there?

I saw the same thing at first glance, but then I looked-up the sizeof()
operator and it seems that sizeof /can/ return the number of bytes in an
array in C99
(http://en.wikipedia.org/wiki/Sizeof#Using_sizeof_with_arrays), but that
might only work with statically-declared arrays, and that's not the
case, here. I can see why confusion might have occurred, especially with
someone with little C experience. :(

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrOcAcACgkQ9CaO5/Lv0PBPGgCgsu1cwLehuq9fvUp5+iVMgnbm
9EwAnAsD5IZTFw08QYfLuK81qvTSS/OS
=RgTy
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to