Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualSpirrwell

Posted 07 May 2012 - 04:10 PM

SDL_Movie *mov; creates a pointer, but it doesn't allocate memory for that pointer. Hence, when you do mov->pFormatCtx = NULL; you get a SIGSEV (which means you're doing things with memory that you don't own), because mov doesn't point to any valid memory. You have to allocate memory for mov first (SDL_Movie *mov = new SDL_Movie;).

[edit]

And yes, that's what I meant by doing a clean rebuild.


I'm not too worried about a memory leak, but do I have to "delete mov"?

edit:

Actually I'm just using C right now, not C++ (for compatibility reasons, I'll leave it at that), but I assume I could use malloc? I've never really used it or know how to, but I'll look into it.

#1Spirrwell

Posted 07 May 2012 - 04:07 PM

SDL_Movie *mov; creates a pointer, but it doesn't allocate memory for that pointer. Hence, when you do mov->pFormatCtx = NULL; you get a SIGSEV (which means you're doing things with memory that you don't own), because mov doesn't point to any valid memory. You have to allocate memory for mov first (SDL_Movie *mov = new SDL_Movie;).

[edit]

And yes, that's what I meant by doing a clean rebuild.


I'm not too worried about a memory leak, but do I have to "delete mov"?

PARTNERS