]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix crash in IpcIoFile::readCompleted() when response is NULL.
authorDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Mon, 27 Jun 2011 21:16:45 +0000 (01:16 +0400)
committerDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Mon, 27 Jun 2011 21:16:45 +0000 (01:16 +0400)
src/DiskIO/IpcIo/IpcIoFile.cc

index 757571d19e1e5f181614199e8cd5f89b8e1b90f6..679b56645fbdad89b63f2d92912d423fe01f57e1 100644 (file)
@@ -201,21 +201,22 @@ IpcIoFile::readCompleted(ReadRequest *readRequest,
     if (!response) {
         debugs(79,1, HERE << "error: timeout");
         ioError = true; // I/O timeout does not warrant setting error_?
-    } else
-    if (response->xerrno) {
-        debugs(79,1, HERE << "error: " << xstrerr(response->xerrno));
-        ioError = error_ = true;
-    }
-    else
-    if (!response->page) {
-        debugs(79,1, HERE << "error: run out of shared memory pages");
-        ioError = true;
     } else {
-        const char *const buf = Ipc::Mem::PagePointer(response->page);
-        memcpy(readRequest->buf, buf, response->len);
-    }
+        if (response->xerrno) {
+            debugs(79,1, HERE << "error: " << xstrerr(response->xerrno));
+            ioError = error_ = true;
+        }
+        else
+        if (!response->page) {
+            debugs(79,1, HERE << "error: run out of shared memory pages");
+            ioError = true;
+        } else {
+            const char *const buf = Ipc::Mem::PagePointer(response->page);
+            memcpy(readRequest->buf, buf, response->len);
+        }
 
-    Ipc::Mem::PutPage(response->page);
+        Ipc::Mem::PutPage(response->page);
+    }
 
     const ssize_t rlen = ioError ? -1 : (ssize_t)readRequest->len;
     const int errflag = ioError ? DISK_ERROR : DISK_OK;