ecore_ipc: prevent a double free.
authorCedric Bail <cedric.bail@samsung.com>
Thu, 28 Nov 2013 08:17:09 +0000 (17:17 +0900)
committerCedric Bail <cedric.bail@samsung.com>
Thu, 28 Nov 2013 08:17:09 +0000 (17:17 +0900)
According to clang static analyzer it is possible to find a path where
buf and svr->buf are pointing to the same array, better be safe than sorry.
Arguably this code could be more readable if it was using Eina_Binbuf.

src/lib/ecore_ipc/ecore_ipc.c

index 8b71783..8b9cb29 100644 (file)
@@ -1517,7 +1517,7 @@ _ecore_ipc_event_server_data(void *data EINA_UNUSED, int ev_type EINA_UNUSED, vo
         else
           {
              scroll:
-             if (buf) free(buf);
+             if (buf != svr->buf) free(buf);
              buf = malloc(svr->buf_size - offset);
              if (!buf)
                {