On Monday, January 26, 2015 11:07:49 AM Juha-Pekka Heikkila wrote:
> added calls to _mesa_error_no_memory() if memory allocation
> returned null pointer.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikk...@gmail.com>
> ---
>  src/util/set.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/util/set.c b/src/util/set.c
> index c3252a0..b0baccc 100644
> --- a/src/util/set.c
> +++ b/src/util/set.c
> @@ -38,6 +38,7 @@
>  #include "macros.h"
>  #include "ralloc.h"
>  #include "set.h"
> +#include "main/errors.h"
>  
>  /*
>   * From Knuth -- a good choice for hash/rehash values is p, p-2 where
> @@ -111,8 +112,10 @@ _mesa_set_create(void *mem_ctx,
>     struct set *ht;
>  
>     ht = ralloc(mem_ctx, struct set);
> -   if (ht == NULL)
> +   if (ht == NULL) {
> +      _mesa_error_no_memory(__func__);
>        return NULL;
> +   }
>  
>     ht->size_index = 0;
>     ht->size = hash_sizes[ht->size_index].size;
> @@ -125,6 +128,7 @@ _mesa_set_create(void *mem_ctx,
>     ht->deleted_entries = 0;
>  
>     if (ht->table == NULL) {
> +      _mesa_error_no_memory(__func__);
>        ralloc_free(ht);
>        return NULL;
>     }
> 

No...just no.  This is a generic data structure implementation.
Hash table and set implementations should not be using OpenGL contexts.
They shouldn't even think about OpenGL contexts.
No good can come of this.

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to