| [AD] A bugfix for datedit.c | 
[ Thread Index | 
Date Index
| More lists.liballeg.org/allegro-developers Archives
] 
Hi,
I discovered a bug in the grabber, where if you were to update the 
datafile more than once per session, it would cause the grabber to 
crash. Attatched is a patch to fix this (the patch is against 4.2.0). 
The problem was in the function clone_properties() in datedit.c which 
would forget to set clone[i].dat to NULL (the previous value having come 
straight from a block of malloc'd memory) if prop[i].dat was NULL.
AE.
*** datedit.old.c	Sat Nov  5 17:16:58 2005
--- datedit.c	Sat May 13 03:24:38 2006
*************** static DATAFILE_PROPERTY *clone_properti
*** 1562,1567 ****
--- 1562,1569 ----
         clone[i].type = prop[i].type;
         if (prop[i].dat)
            clone[i].dat = ustrdup(prop[i].dat);
+ 	   else
+           clone[i].dat = NULL;
     }
  
     return clone;