summaryrefslogtreecommitdiff
path: root/source3/printing/print_svid.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/printing/print_svid.c')
-rw-r--r--source3/printing/print_svid.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c
index 5c5eebeb50..85eaf8f95d 100644
--- a/source3/printing/print_svid.c
+++ b/source3/printing/print_svid.c
@@ -60,7 +60,17 @@ static void populate_printers(void)
if (((tmp = strchr(buf, ' ')) == NULL) ||
((tmp = strchr(++tmp, ' ')) == NULL))
continue;
- name = ++tmp;
+
+ /*
+ * In case we're only at the "for ".
+ */
+
+ if(!strncmp("for ",++tmp,4))
+ {
+ tmp=strchr(tmp, ' ');
+ tmp++;
+ }
+ name = tmp;
/* truncate the ": ..." */
if ((tmp = strchr(name, ':')) != NULL)
@@ -69,9 +79,12 @@ static void populate_printers(void)
/* add it to the cache */
if ((ptmp = malloc(sizeof (*ptmp))) != NULL) {
ZERO_STRUCTP(ptmp);
- ptmp->name = strdup(name);
+ if((ptmp->name = strdup(name)) == NULL)
+ DEBUG(0,("populate_printers: malloc fail in strdup !\n"));
ptmp->next = printers;
printers = ptmp;
+ } else {
+ DEBUG(0,("populate_printers: malloc fail for ptmp\n"));
}
}
pclose(fp);