Mesa (master): os: Fix bad calloc.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Sun Feb 14 23:30:11 UTC 2010


Module: Mesa
Branch: master
Commit: 33682e551036abcef4fb6d55aab15a25a58c5457
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=33682e551036abcef4fb6d55aab15a25a58c5457

Author: José Fonseca <jfonseca at vmware.com>
Date:   Sun Feb 14 23:03:10 2010 +0000

os: Fix bad calloc.

---

 src/gallium/auxiliary/os/os_stream_stdc.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_stream_stdc.c b/src/gallium/auxiliary/os/os_stream_stdc.c
index 9a62799..9e7ed71 100644
--- a/src/gallium/auxiliary/os/os_stream_stdc.c
+++ b/src/gallium/auxiliary/os/os_stream_stdc.c
@@ -60,9 +60,6 @@ os_stdc_stream_close(struct os_stream *_stream)
 {
    struct os_stdc_stream *stream = os_stdc_stream(_stream);
 
-   if(!stream)
-      return;
-   
    fclose(stream->file);
 
    free(stream);
@@ -74,9 +71,6 @@ os_stdc_stream_write(struct os_stream *_stream, const void *data, size_t size)
 {
    struct os_stdc_stream *stream = os_stdc_stream(_stream);
 
-   if(!stream)
-      return FALSE;
-   
    return fwrite(data, size, 1, stream->file) == size ? TRUE : FALSE;
 }
 
@@ -86,9 +80,6 @@ os_stdc_stream_flush(struct os_stream *_stream)
 {
    struct os_stdc_stream *stream = os_stdc_stream(_stream);
 
-   if(!stream)
-      return;
-   
    fflush(stream->file);
 }
 
@@ -98,7 +89,7 @@ os_file_stream_create(const char *filename)
 {
    struct os_stdc_stream *stream;
 
-   stream = (struct os_stdc_stream *)calloc(1, sizeof(struct os_stream));
+   stream = (struct os_stdc_stream *)calloc(1, sizeof(*stream));
    if(!stream)
       goto no_stream;
 




More information about the mesa-commit mailing list