]> git.sesse.net Git - cubemap/commitdiff
Fix a memory leak with raw inputs.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 27 May 2016 08:13:26 +0000 (10:13 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 27 May 2016 08:13:26 +0000 (10:13 +0200)
httpinput.cpp

index 9dcaeaa0191dd1951fc8fdb15f34148468c563c0..78e73a10eb9afeb5724ebbaa4efa6b0d9cb36f57 100644 (file)
@@ -495,7 +495,6 @@ void HTTPInput::do_work()
 
 void HTTPInput::process_data(char *ptr, size_t bytes)
 {
 
 void HTTPInput::process_data(char *ptr, size_t bytes)
 {
-       pending_data.insert(pending_data.end(), ptr, ptr + bytes);
        {
                MutexLock mutex(&stats_mutex);
                stats.bytes_received += bytes;
        {
                MutexLock mutex(&stats_mutex);
                stats.bytes_received += bytes;
@@ -509,6 +508,7 @@ void HTTPInput::process_data(char *ptr, size_t bytes)
        }
 
        assert(encoding == Input::INPUT_ENCODING_METACUBE);
        }
 
        assert(encoding == Input::INPUT_ENCODING_METACUBE);
+       pending_data.insert(pending_data.end(), ptr, ptr + bytes);
 
        for ( ;; ) {
                // If we don't have enough data (yet) for even the Metacube header, just return.
 
        for ( ;; ) {
                // If we don't have enough data (yet) for even the Metacube header, just return.