Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mimeDelete should free filters before types #1558

Closed
michaelrsweet opened this issue Apr 12, 2006 · 2 comments
Closed

mimeDelete should free filters before types #1558

michaelrsweet opened this issue Apr 12, 2006 · 2 comments

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2-current
CUPS.org User: jlovell

mimeDelete should free filters before types.

Steps to reproduce:

$ sudo gdb -q cupsd
(gdb) set env DYLD_INSERT_LIBRARIES /usr/local/lib/libgmalloc.B.dylib
(gdb) r -f
Starting program: /usr/sbin/cupsd -f
Allocations will be placed on word (4 byte) boundaries.
...
From another shell:
$ sudo killall -HUP cupsd
...
Program received signal SIGHUP, Hangup.
0x9001f8c8 in select ()
(gdb) c
Continuing.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xb0d95fec
0x90002a20 in strcmp ()
(gdb) bt
#0 0x90002a20 in strcmp ()
#1 0x0005334c in compare_filters (f0=0xb0f1def4, f1=0xb0f1def4) at filter.c:189
#2 0x00219fdc in cups_array_find (a=0xb0f1bf5c, e=0xb0f1def4, prev=0, rdiff=0xbfffab60) at array.c:859
#3 0x002197f0 in cupsArrayRemove (a=0xb0f1bf5c, e=0xb0f1def4) at array.c:568
#4 0x00052c8c in mimeDeleteFilter (mime=0xb0cf1ff8, filter=0xb0f1def4) at mime.c:138
#5 0x00052be4 in mimeDelete (mime=0xb0cf1ff8) at mime.c:115
#6 0x000262c8 in cupsdReadConfiguration () at conf.c:949
#7 0x00003590 in main (argc=2, argv=0xbffff6cc) at main.c:634

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"mime.c.patch":

Index: mime.c

--- mime.c (revision 5390)
+++ mime.c (working copy)
@@ -97,6 +97,15 @@
return;

/*

  • * Loop through filters and free them...
  • */
  • for (filter = (mime_filter_t *)cupsArrayFirst(mime->filters);
  •   filter;
    
  •   filter = (mime_filter_t *)cupsArrayNext(mime->filters))
    
  • mimeDeleteFilter(mime, filter);
  • /*
    • Loop through the file types and delete any rules...
      */

@@ -106,15 +115,6 @@
mimeDeleteType(mime, type);

/*

  • * Loop through filters and free them...

- */

  • for (filter = (mime_filter_t *)cupsArrayFirst(mime->filters);
  •   filter;
    
  •   filter = (mime_filter_t *)cupsArrayNext(mime->filters))
    

- mimeDeleteFilter(mime, filter);

  • /*
    • Free the types and filters arrays, and then the MIME database structure.
      */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant