You can use mason jars for freezing, however there is a risk of breakage. Be sure to leave adequate headspace at the top to allow frozen pesto to expand and freeze the jars without the lids. Once frozen, you can secure the lids, but be sure not to wrench them too tightly. Close the lids just until there's a bit of resistance.