Error handling for function calls to parse a GIF file
Without knowing the context, I'd write it as:

if( (errno = GifLoad( g, &amp;bufTemp )) == GIF_SUCCESS ) {
  // Process the correctly loaded image as necessary.
  GifProcess( g );
}

// Release memory once processing is complete.
GifDispose( g );
*gPtr = NULL;

// Single exit point to the function.
return errno;


Then write a wrapper for GifLoad that calls the three other functions.

This might not be a suitable solution if, for example, the processing is part of an interactive program wherein the processing is indeterminate. If processing cannot be coded at this point in the source, then consider:

if( (errno = GifLoad( g, &amp;bufTemp )) != GIF_SUCCESS ) {
  // Perform whatever is necessary to inform the user the GIF cannot be loaded.
  GifInvalid( g );

  // Release memory.
  GifDispose( g );
  *gPtr = NULL;
}

return errno;


In both cases consider abstracting the three function calls into a single function, which cleans up the code and expresses the intent of those three function calls more concisely.