gallium: Fix seg fault (James Vogt).
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Tue, 15 Apr 2008 06:58:14 +0000 (15:58 +0900)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Tue, 15 Apr 2008 06:58:14 +0000 (15:58 +0900)
src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c

index bffca5b2449f3fe20b03f6cea7d180a4d27590e2..9d809e2f9b5e5ac86ade9932556463c5b80398fb 100644 (file)
@@ -30,7 +30,7 @@
  * \file
  * A buffer manager that wraps buffers in fenced buffers.
  * 
- * \author José Fonseca <jrfonseca@tungstengraphics.dot.com>
+ * \author José Fonseca <jrfonseca@tungstengraphics.dot.com>
  */
 
 
@@ -101,7 +101,8 @@ fenced_bufmgr_destroy(struct pb_manager *mgr)
 
    fenced_buffer_list_destroy(fenced_mgr->fenced_list);
 
-   fenced_mgr->provider->destroy(fenced_mgr->provider);
+   if(fenced_mgr->provider)
+      fenced_mgr->provider->destroy(fenced_mgr->provider);
    
    FREE(fenced_mgr);
 }
@@ -113,6 +114,9 @@ fenced_bufmgr_create(struct pb_manager *provider,
 {
    struct fenced_pb_manager *fenced_mgr;
 
+   if(!provider)
+      return NULL;
+   
    fenced_mgr = (struct fenced_pb_manager *)CALLOC(1, sizeof(*fenced_mgr));
    if (!fenced_mgr)
       return NULL;