summaryrefslogtreecommitdiff
path: root/source3/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
commit008fd973097303ac984cd7c004e3dea67d54813d (patch)
tree9b3d2d82075cf04cbff491c9754cdedf103aeb0d /source3/utils/make_printerdef.c
parentd455d42234ebe28f00ae360627fcb2a2f88787e0 (diff)
downloadsamba-008fd973097303ac984cd7c004e3dea67d54813d.tar.gz
samba-008fd973097303ac984cd7c004e3dea67d54813d.tar.bz2
samba-008fd973097303ac984cd7c004e3dea67d54813d.zip
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. (This used to be commit 3fd28812f75f2311a114ff905143634e3bbb1fac)
Diffstat (limited to 'source3/utils/make_printerdef.c')
-rw-r--r--source3/utils/make_printerdef.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/source3/utils/make_printerdef.c b/source3/utils/make_printerdef.c
index aad5bc56f4..c64ce64bbf 100644
--- a/source3/utils/make_printerdef.c
+++ b/source3/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:",