Re: [PATCH] fsck: free buffers on error in fsck_obj()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 10, 2017 at 11:42:10AM +0200, René Scharfe wrote:

> Move the code for releasing tree buffers and commit buffers in
> fsck_obj() to the end of the function and make sure it's executed no
> matter of an error is encountered or not.

This looks good to me.

> @@ -374,7 +369,12 @@ static int fsck_obj(struct object *obj)
>  		}
>  	}
>  
> -	return 0;
> +out:
> +	if (obj->type == OBJ_TREE)
> +		free_tree_buffer((struct tree *)obj);
> +	if (obj->type == OBJ_COMMIT)
> +		free_commit_buffer((struct commit *)obj);
> +	return err;
>  }

The second one could be "else if". But then, the same could be said of
the rest of the function (and fsck_object() that we call). It probably
doesn't really matter in practice.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux