[Mplayer-cvslog] CVS: main/libmpdemux demux_mkv.cpp,1.39,1.40

Alex Beregszaszi alex at fsn.hu
Wed Oct 22 20:25:14 CEST 2003


Hi,

> +#define safefree(m) { if (m != NULL) free(m); }
> +void *safemalloc(int bytes) {
> +  void *dst;
> +
> +  dst = malloc(bytes);
> +  if (dst == NULL) {
> +    mp_msg(MSGT_DEMUX, MSGL_FATAL, "[mkv] Could not allocate %d bytes
> of "+          "memory.\n", bytes);
> +    exit(1);
> +  }
> +
> +  return dst;
> +}
> +
> +void *safememdup(const void *src, int bytes) {
> +  void *dst;
> +
> +  dst = safemalloc(bytes);
> +  memcpy(dst, src, bytes);
> +
> +  return dst;
> +}
> +

Eh?! Never ever use exit() in libraries!

-- 
Alex Beregszaszi <alex at fsn.hu>
(MPlayer Core Developer -- http://www.mplayerhq.hu/)



More information about the MPlayer-cvslog mailing list