[PATCH] Fix memory leak in JpegIO reported by Sentry
#1
Hi folks,

Sentry (our C++ static analysis tool) reported a memory leak last night that appears to have been introduced in this commit: https://github.com/xbmc/xbmc/commit/678f90b

Here's a patch that should fix it:

Code:
diff --git a/xbmc/guilib/JpegIO.cpp b/xbmc/guilib/JpegIO.cpp
index 0e27d44..207c697 100644
--- a/xbmc/guilib/JpegIO.cpp
+++ b/xbmc/guilib/JpegIO.cpp
@@ -273,6 +273,7 @@ bool CJpegIO::Decode(const unsigned char *pixels, unsigned i
         }
         dst += pitch;
       }
+      delete[] row;
     }
     else
     {

(We've added xbmc to our open source analysis project, so we'll be looking for bugs in it on a daily basis.)

Thanks!
Mike
Reply
#2
Aurgh, ofcourse. Thanks. I was using libjpeg's allocater which cleans up after itself, but decided to bail on that. When I did, forgot to clean up after myself. Thanks for that, will fix asap.
Reply
#3
Great, happy to help. Smile
Reply
#4
Comitted in 8090a881. Thanks again!

TheUni
Reply

Logout Mark Read Team Forum Stats Members Help
[PATCH] Fix memory leak in JpegIO reported by Sentry0