summaryrefslogtreecommitdiffstats
path: root/xstrdup.c
blob: 036b3b29fd78a0fe1fd28928474c3105b2575385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * xstrdup.c
 *
 * Simple error-checking version of strdup()
 *
 */

#include "config.h"

char *xstrdup(const char *s)
{
  char *p = strdup(s);

  if ( !p ) {
    fprintf(stderr, "Out of memory!\n");
    exit(128);
  }

  return p;
}