projects
/
ir-tcl-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug fix: cs_type member renamed to comstackType to avoid conflict with
[ir-tcl-moved-to-github.git]
/
mem.c
diff --git
a/mem.c
b/mem.c
index
90ab67c
..
12ece38
100644
(file)
--- a/
mem.c
+++ b/
mem.c
@@
-5,7
+5,10
@@
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: mem.c,v $
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: mem.c,v $
- * Revision 1.1 1995-08-04 11:32:40 adam
+ * Revision 1.2 1995-08-29 15:30:15 adam
+ * Work on GRS records.
+ *
+ * Revision 1.1 1995/08/04 11:32:40 adam
* More work on output queue. Memory related routines moved
* to mem.c
*
* More work on output queue. Memory related routines moved
* to mem.c
*
@@
-37,14
+40,22
@@
void *ir_tcl_malloc (size_t n)
*/
int ir_tcl_strdup (Tcl_Interp *interp, char** p, const char *s)
{
*/
int ir_tcl_strdup (Tcl_Interp *interp, char** p, const char *s)
{
+ size_t len;
+
if (!s)
{
*p = NULL;
return TCL_OK;
}
if (!s)
{
*p = NULL;
return TCL_OK;
}
- *p = malloc (strlen(s)+1);
+ len = strlen(s)+1;
+ *p = malloc (len);
if (!*p)
{
if (!*p)
{
+ if (!interp)
+ {
+ logf (LOG_FATAL, "Out of memory in strdup. %ld bytes", len);
+ exit (1);
+ }
interp->result = "strdup fail";
return TCL_ERROR;
}
interp->result = "strdup fail";
return TCL_ERROR;
}