cvs: pecl /printer printer.c
| From: | Frank M. Kromann | Date: | Tue, 02 Dec 2003 23:02:57 +0000 |
| Subject: | cvs: pecl /printer printer.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-547@lists.php.net to get a copy of this message | ||
fmk Tue Dec 2 18:02:57 2003 EDT
Modified files:
/pecl/printer printer.c
Log:
Fix #25052.
Mix static and dynamic alocated strings
Index: pecl/printer/printer.c
diff -u pecl/printer/printer.c:1.24 pecl/printer/printer.c:1.25
--- pecl/printer/printer.c:1.24 Sat Jan 4 06:56:01 2003
+++ pecl/printer/printer.c Tue Dec 2 18:02:56 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: printer.c,v 1.24 2003/01/04 11:56:01 mj Exp $ */
+/* $Id: printer.c,v 1.25 2003/12/02 23:02:56 fmk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -111,7 +111,7 @@
php_info_print_table_row(2, "Printer Support", "enabled");
php_info_print_table_row(2, "Default printing device", PRINTERG(default_printer) ?
PRINTERG(default_printer) : "<b>not detected</b>");
php_info_print_table_row(2, "Module state", "working");
- php_info_print_table_row(2, "RCS Version", "$Id: printer.c,v 1.24 2003/01/04
11:56:01 mj Exp $");
+ php_info_print_table_row(2, "RCS Version", "$Id: printer.c,v 1.25 2003/12/02
23:02:56 fmk Exp $");
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
@@ -280,7 +280,7 @@
resource->info.lpszDocName = "PHP generated Document";
resource->info.lpszOutput = NULL;
- resource->info.lpszDatatype = "TEXT";
+ resource->info.lpszDatatype = estrdup("TEXT");
resource->info.fwType = 0;
resource->info.cbSize = sizeof(resource->info);
resource->dc = CreateDC(NULL, resource->name, NULL, resource->device);
@@ -488,7 +488,10 @@
case MODE:
convert_to_string_ex(arg3);
- resource->info.lpszDatatype = Z_STRVAL_PP(arg3);
+ if (resource->info.lpszDatatype) {
+ efree((char *)resource->info.lpszDatatype);
+ }
+ resource->info.lpszDatatype = estrdup(Z_STRVAL_PP(arg3));
resource->info.cbSize = sizeof(resource->info);
break;
@@ -1322,6 +1325,9 @@
printer *p = (printer*)resource->ptr;
ClosePrinter(p->handle);
+ if (p->info.lpszDatatype) {
+ efree((char *)p->info.lpszDatatype);
+ }
efree(p);
}
static void object_close(zend_rsrc_list_entry *resource TSRMLS_DC)