driverless: Fix double free and select() timeout handling
@@ -96,16 +96,13 @@ copy_output(int read_ipp_fd, /* I - IPP file descriptor */
FD_ZERO(&input);
FD_SET(read_ipp_fd, &input);
FD_SET(read_ipps_fd, &input);
- timeout.tv_sec = 2;
- timeout.tv_usec = 0;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 200000;
if (select(nfds, &input, NULL, NULL, &timeout) < 0)
return (-1);
if (!FD_ISSET(read_ipp_fd, &input) && !FD_ISSET(read_ipps_fd, &input))
- {
- return (0);
- }
-
+ continue;
if(FD_ISSET(read_ipps_fd, &input))
{
@@ -159,7 +156,6 @@ copy_output(int read_ipp_fd, /* I - IPP file descriptor */
ippfind_output = (char *)malloc(MAX_OUTPUT_LEN*(sizeof(char)));
ptr = buffer;
-
while (ptr && !isalnum(*ptr & 255)) ptr ++;
if ((!strncasecmp(ptr, "ipp", 3) && ptr[3] == '\t'))
@@ -195,6 +191,7 @@ copy_output(int read_ipp_fd, /* I - IPP file descriptor */
}
}
+
void
listPrintersInArray(int reg_type_no, int mode, int isFax, char* ippfind_output ) {
int driverless_support = 0, /*process id for ippfind */
@@ -775,9 +772,6 @@ list_printers (int mode, int reg_type_no, int isFax)
}
}
- cupsArrayDelete(service_uri_list_ipps);
- cupsArrayDelete(service_uri_list_ipp);
-
/*
* Exit...
*/
