What happens if you don't enjoy your research partially through your degree? I'm a sophomore at a Canadian university studying mathematics. Since near the end of first year, I've thought about attending graduate school for some mathematics field (this could also be because I don't know what else I can do with my degree/knowledge). 

I'm thinking about it now, however, and I've noticed (through painstakingly unfortunate experiences and unnecessary, overly-ambitious classes this year) that perhaps mathematics may not be my life (although I do enjoy reading on it, studying/looking into different aspects of the field, and even if I don't do well on an assignment, test, or class altogether, I'm not typically turned off of that subject if it is maths-related). 

Thus, I'm thinking about this as someone who could potentially be doing this in grad school. Right now, I have the freedom to take other, non-maths courses (I'm minoring in film, for example). Will this freedom continue in grad school? As well, I'm fortunate enough to be in an undergrad program that encourages cross-faculty research. Thus, if I wanted to look at mathematics from a film point of view (or vice versa) for a research project or thesis, it would be encouraged. However, from what I'm seeing from my grad school research, you are typically in grad school for one specific field and do research in that topic for your entire degree (which, I understand is usually less than the 3/4 years of undergrad study). 

So I guess my question is, what do you do if you're in grad school but grow weary of your research? I'm sure you can't just up and leave, but what if you want to research something that isn't offered by a grad institution, or want to merge two topics together? How does the process work then? Or what if I wanted to do research with the philosophy department on a mathematical topic (e.g. something like logic)? How would that work? 

Do grad institutions give a degree of freedom to their students, or is it all about the adviser and what they want? And if the latter is the case, what do you do if you don't want that? Do you have to just suck it up and do it anyway?
First of all, as @ff524 points out there is a world of difference between a master's program and a PhD program.  If you don't understand the difference, then you know too little about graduate school to be thinking about it any meaningful way.

In the US a math master's degree takes about 1-2 years and is not a prerequisite for a math PhD program.  (In fact, although some students can use a strong performance in a master's degree to "launder" their academic record and gain admittance to a solid PhD program, in most cases enrolling in a master's program signals a much smaller commitment than enrolling in a PhD program.)  In Canada it seems to take a bit longer: 2-3 years, and up until recently it was viewed as a prerequisite to getting a PhD.  (Things seem to be changing a bit, although still probably the majority of Canadian math PhD students have done separate master's degrees, which adds to the total time to get a PhD).  Getting a PhD in either Canada or the US takes 4-7 years; I believe 5 years is the most frequent number though the mean is higher.   Moreover a PhD is the required certification for a future academic career in mathematics (it used to be that a master's degree let you teach at 2 year colleges, but that is rapidly ceasing to be the case in the current job market).  The purpose of a master's degree in mathematics is much more fluid...or it may serve no purpose at all.  You should know that the lowest common denominator for master's degrees in math is indeed very low: it is well known to US graduate programs that an undergraduate degree at a top institution with good grades is usually better than a master's degree at a mediocre institution.

It is fairly easy to "weather through" a master's degree in mathematics, even if your level of interest wanes in the middle (because there need not be much middle, in part).  If you have some specific career goal for which a master's degree in mathematics would be advantageous -- e.g. high school teaching -- then not being unilaterally devoted to mathematics is not a serious obstruction.  By contrast, if you are not interested in mathematics almost to the exclusion of other academic fields, then a PhD program in mathematics is probably not for you.  (Certain branches of applied mathematics are exceptions to this, but the vast majority of students who do a PhD in a "mathematics department" are not that applied.)  


  Right now, I have the freedom to take other, non-maths courses (I'm minoring in film, for example). Will this freedom continue in grad school?


Technically yes -- graduate students are allowed to enroll for courses in any department just like undergraduates.  In practice: the freedom will be severely restricted.  If as a graduate student you take a course outside of your department then you should expect to be asked to explain its relevance to your mathematical course of study.  Thus it is relatively common to take language courses and courses in related fields (cs, physics, statistics...).  You should probably not be taking "elective" courses -- e.g. if you took a course in film, it would have to be strongly skewed to the technical aspects of image production / reconstruction / whatever or you will probably find yourself having to defend doing something that interferes with your research.

Moreover, theoretical mathematics (and some branches of applied mathematics) is one of the least interdisciplinary of academic fields.  If you want to work on logic, then you may well find an expert advisor or co-advisor in the philosophy department -- but nevertheless you should expect your work to be at least 90% mathematics.  There must be a few math PhD students who take more than a small handful of philosophy courses...but I have never met any.

All in all: you should not seriously consider a PhD program in mathematics unless (i) you are single-mindedly, passionately devoted to mathematics or (ii) you have a very specific career goal for which a PhD in mathematics is beneficial, and your plan has been vetted as reasonable by multiple trusted mentors.  If you like but don't love mathematics as you are completing your undergraduate degree, plan on continuing to read, learn and perhaps do mathematics after you graduate, at your own pace...as a hobby.