Bug 887598 - xloadimage has a memory leak and will crash if enough images are viewed and does not work with delays <1second.
Summary: xloadimage has a memory leak and will crash if enough images are viewed and d...
Keywords:
Status: CLOSED DUPLICATE of bug 887597
Alias: None
Product: Fedora
Classification: Fedora
Component: xloadimage
Version: 17
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-16 18:18 UTC by Roger Heflin
Modified: 2012-12-17 15:17 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-12-17 15:17:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Roger Heflin 2012-12-16 18:18:32 UTC
Description of problem:

Xloadimage has a memory leak and will crash if enough images are viewed one after another.    I include the patch to correct the issue, and an additional patch to adjust the -delay option to allow <1second delays, the delay patch does not change the way xloadimage works except for allowing <1 second decimal values to work.   Man page does not indicate that only integers are allowed, and it seems reasonable to allow <1 second delays.


Version-Release number of selected component (if applicable):
Fedora 17


How reproducible:
Likely only crashes on 32bit, on 64 bit will have excessive memory consumption and probably page excessively.


Steps to Reproduce:
1.   xloadimage  *.jpg with enough images and hit N until it crashes...it may not crash on 64bit but the machine will eventually start paging, on 32bit it will crash when it hits around 2GB.
2.   hit n until it crashes, with ps one can see that with each image viewed the memory size is growing.
3.
  
Actual results:
it crashes.

Expected results:
no crash.

Additional info:
Patches:

Patch to fix bug:
-- new.c.orig	2012-12-16 11:15:06.753666740 -0600
+++ new.c	2012-12-16 11:15:28.042023127 -0600
@@ -181,7 +181,7 @@
   image->depth= 24;
   image->pixlen= 3;
   image->data= (unsigned char *)lmalloc(ovmul(ovmul(width, height), 3));
-  image->data= (unsigned char *)lmalloc(width * height * 3);
+/*  image->data= (unsigned char *)lmalloc(width * height * 3); */
   return(image);
 }
 


Patches to add -delay <1 functionality, delay otherwise still works exactly as is described in the man page just allowing <1 second to be valid.

--- options.c.orig	2012-12-16 11:16:05.147899943 -0600
+++ options.c	2012-12-16 11:16:41.897787363 -0600
@@ -720,7 +720,7 @@
       
       continue;
 #else /* !NO_DELAY */
-      newopt->info.delay= getInteger(DELAY, argv[a]);
+      newopt->info.delay= getFloat(DELAY, argv[a]);
       break;
 #endif /* !NO_DELAY */
 
--- options.h.orig	2012-12-16 11:16:09.440769951 -0600
+++ options.h	2012-12-16 11:17:20.620614643 -0600
@@ -49,7 +49,7 @@
       unsigned int x, y, w, h; /* area of image to be used */
     } clip;
     unsigned int  colors;     /* max # of colors to use for this image */
-    unsigned int  delay;      /* # of seconds delay before auto pic advance */
+    double  delay;      /* # of seconds delay before auto pic advance */
     char         *display;    /* display name */
     struct {
       char *type; /* image type */
--- window.c.orig	2012-12-16 11:42:35.779494949 -0600
+++ window.c	2012-12-16 11:44:52.846362310 -0600
@@ -583,9 +583,9 @@
   install= (getOption(global_options, INSTALL) != NULL);
   private_cmap= (getOption(global_options, PRIVATE) != NULL);
   if ((opt= getOption(image_options, DELAY)))
-    delay= opt->info.delay;
+    delay= opt->info.delay*1000000;
   else if ((opt= getOption(global_options, DELAY)))
-    delay= opt->info.delay;
+    delay= opt->info.delay*1000000;
   else
     delay= 0;
   if ((opt= getOption(image_options, VISUAL)))
@@ -872,7 +872,7 @@
 #ifdef ENABLE_TIMEOUT
       AlarmWentOff = 0;
       signal(SIGALRM, delayAlarmHandler);
-      alarm(delay);
+      ualarm(delay,0);
 #endif /* ENABLE_TIMEOUT */
   }

Comment 1 Tom "spot" Callaway 2012-12-17 15:17:11 UTC

*** This bug has been marked as a duplicate of bug 887597 ***


Note You need to log in before you can comment on or make changes to this bug.