summaryrefslogtreecommitdiff
path: root/source/utils/make_printerdef.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-09-28 23:55:09 +0000
committerJeremy Allison <jra@samba.org>1998-09-28 23:55:09 +0000
commit3fd28812f75f2311a114ff905143634e3bbb1fac (patch)
tree09d73a770fe3da8e44485d5c0c421b4d5c9c29ee /source/utils/make_printerdef.c
parent2c6bbc2da72af4508aa8c49d003f211da5cbe5ae (diff)
downloadsamba-3fd28812f75f2311a114ff905143634e3bbb1fac.tar.gz
Fixed problems found in lint pass over the old code by <cpeterso@microsoft.com>.
These were the problems that still existed in the 2.0 branch. Jeremy.
Diffstat (limited to 'source/utils/make_printerdef.c')
-rw-r--r--source/utils/make_printerdef.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/source/utils/make_printerdef.c b/source/utils/make_printerdef.c
index aad5bc56f43..c64ce64bbf5 100644
--- a/source/utils/make_printerdef.c
+++ b/source/utils/make_printerdef.c
@@ -84,6 +84,12 @@ static char *scan(char *chaine,char **entry)
*entry=(char *)malloc(sizeof(pstring));
value=(char *)malloc(sizeof(pstring));
+
+ if(*entry == NULL || value == NULL) {
+ fprintf(stderr,"scan: malloc fail !\n");
+ exit(1);
+ }
+
pstrcpy(*entry,chaine);
temp=chaine;
while( temp[i]!='=' && temp[i]!='\0') {
@@ -134,6 +140,11 @@ static void lookup_strings(FILE *fichier)
temp=(char *)malloc(sizeof(pstring));
temp2=(char *)malloc(sizeof(pstring));
+ if(temp == NULL || temp2 == NULL) {
+ fprintf(stderr,"lookup_strings: malloc fail !\n");
+ exit(1);
+ }
+
*sbuffer[0]='\0';
pstrcpy(temp2,"[Strings]");
@@ -184,6 +195,11 @@ static void lookup_entry(FILE *fichier,char *chaine)
temp=(char *)malloc(sizeof(pstring));
temp2=(char *)malloc(sizeof(pstring));
+ if(temp == NULL || temp2 == NULL) {
+ fprintf(stderr,"lookup_entry: malloc fail !\n");
+ exit(1);
+ }
+
*buffer[0]='\0';
pstrcpy(temp2,"[");
@@ -236,7 +252,7 @@ static char *find_desc(FILE *fichier,char *text)
long_desc=(char *)malloc(sizeof(pstring));
short_desc=(char *)malloc(sizeof(pstring));
if (!chaine || !long_desc || !short_desc) {
- fprintf(stderr,"Unable to malloc memory\n");
+ fprintf(stderr,"find_desc: Unable to malloc memory\n");
exit(1);
}
@@ -363,7 +379,10 @@ static void scan_short_desc(FILE *fichier, char *short_desc)
helpfile=0;
languagemonitor=0;
datatype="RAW";
- temp=(char *)malloc(sizeof(pstring));
+ if((temp=(char *)malloc(sizeof(pstring))) == NULL) {
+ fprintf(stderr, "scan_short_desc: malloc fail !\n");
+ exit(1);
+ }
driverfile=short_desc;
datafile=short_desc;
@@ -472,7 +491,10 @@ int main(int argc, char *argv[])
lookup_entry(inf_file,"DestinationDirs");
build_subdir();
- files_to_copy=(char *)malloc(2048*sizeof(char));
+ if((files_to_copy=(char *)malloc(2048*sizeof(char))) == NULL) {
+ fprintf(stderr, "%s: malloc fail.\n", argv[0] );
+ exit(1);
+ }
*files_to_copy='\0';
scan_short_desc(inf_file,short_desc);
fprintf(stdout,"%s:%s:%s:",