Check result of my_malloc() in my_strdup()
parent
5f7f9d83c3
commit
16397e50bc
|
@ -29,14 +29,15 @@
|
|||
#define TIMESTAMP() (0)
|
||||
#endif
|
||||
|
||||
#undef DEBUG_MEMORY
|
||||
|
||||
#if 1
|
||||
#ifndef DEBUG_MEMORY
|
||||
static void
|
||||
init_mem_stuff (void)
|
||||
{
|
||||
}
|
||||
#else
|
||||
#define ALIGN 4
|
||||
#define ALIGN 8
|
||||
#include <libxml/xmlmemory.h>
|
||||
|
||||
static gpointer
|
||||
|
@ -67,7 +68,8 @@ my_strdup (const char *s)
|
|||
if (s)
|
||||
{
|
||||
char *new_s = my_malloc (strlen (s) + 1);
|
||||
strcpy (new_s, s);
|
||||
if (new_s)
|
||||
strcpy (new_s, s);
|
||||
return new_s;
|
||||
}
|
||||
else
|
||||
|
@ -93,7 +95,7 @@ init_mem_stuff (void)
|
|||
NULL, NULL, NULL
|
||||
};
|
||||
|
||||
if (0)
|
||||
if (1)
|
||||
{
|
||||
g_mem_set_vtable (&mem_table);
|
||||
g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, TRUE);
|
||||
|
|
|
@ -28,14 +28,15 @@
|
|||
#define TIMESTAMP() (0)
|
||||
#endif
|
||||
|
||||
#undef DEBUG_MEMORY
|
||||
|
||||
#if 1
|
||||
#ifndef DEBUG_MEMORY
|
||||
static void
|
||||
init_mem_stuff (void)
|
||||
{
|
||||
}
|
||||
#else
|
||||
#define ALIGN 4
|
||||
#define ALIGN 8
|
||||
#include <libxml/xmlmemory.h>
|
||||
|
||||
static gpointer
|
||||
|
@ -66,7 +67,8 @@ my_strdup (const char *s)
|
|||
if (s)
|
||||
{
|
||||
char *new_s = my_malloc (strlen (s) + 1);
|
||||
strcpy (new_s, s);
|
||||
if (new_s)
|
||||
strcpy (new_s, s);
|
||||
return new_s;
|
||||
}
|
||||
else
|
||||
|
@ -92,7 +94,7 @@ init_mem_stuff (void)
|
|||
NULL, NULL, NULL
|
||||
};
|
||||
|
||||
if (0)
|
||||
if (1)
|
||||
{
|
||||
g_mem_set_vtable (&mem_table);
|
||||
g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, TRUE);
|
||||
|
|
Loading…
Reference in New Issue