Remove useless checks for NULL before freeing
This patch has been generated by the following Coccinelle semantic patch: // Remove useless checks for NULL before freeing // // free (NULL) is a no-op, so there is no need to avoid it @@ expression E; @@ + free (E); + E = NULL; - if (unlikely (E != NULL)) { - free(E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; type T; @@ + free ((T) E); + E = NULL; - if (unlikely (E != NULL)) { - free((T) E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; @@ + free (E); - if (unlikely (E != NULL)) { - free (E); - } @@ expression E; type T; @@ + free ((T) E); - if (unlikely (E != NULL)) { - free ((T) E); - } Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
@@ -382,8 +382,7 @@ _mesa_delete_program(struct gl_context *ctx, struct gl_program *prog)
|
||||
if (prog == &_mesa_DummyProgram)
|
||||
return;
|
||||
|
||||
if (prog->String)
|
||||
free(prog->String);
|
||||
free(prog->String);
|
||||
|
||||
if (prog->Instructions) {
|
||||
_mesa_free_instructions(prog->Instructions, prog->NumInstructions);
|
||||
|
Reference in New Issue
Block a user