Package: joy2key
Version: 1.6.1
Tags: patch

When running joy2key with the standard config file and specifing the
-dev argument in the file, joy2key segfaulted. A quick look revealed
some very suspecious looking frees, I reworded them and the segfault
does not occur anymore and I suspect I found a memory leak...

Mfg

Matthias

-- 
Matthias Bläsing (GPG-Schlüsselkennung: A71B4BD5)
ICQ: 84617206   AIM: linuxfun81   MSN: [EMAIL PROTECTED]
--- joy2key.c.old	2006-12-26 06:33:25.000000000 +0100
+++ joy2key.c	2006-12-26 06:44:11.000000000 +0100
@@ -387,7 +387,7 @@
 					}
 					if(feof(file)) rcargv[rcargc]=strdup(line);
 					process_args(rcargc, rcargv);
-					for(rcargc--;rcargc-1;rcargc--) free(rcargv[rcargc]);
+					for(rcargc--;rcargc>=0;rcargc--) free(rcargv[rcargc]);
 				}		
 				fscanf(file, " %s ", line);
 			}
@@ -437,8 +437,8 @@
 						if(feof(file)) rcargv[rcargc]=strdup(line);
 /* XXX			process_args(rcargc+1, rcargv); */
 						process_args(rcargc, rcargv);
-						for(rcargc--;rcargc-1;rcargc--) free(rcargv[rcargc]);
-					}		
+                                                for(rcargc--;rcargc>=0;rcargc--) free(rcargv[rcargc]);
+		        		}		
 					fscanf(file, " %s ", line);
 				}
 				rewind(file);
@@ -468,7 +468,7 @@
 						if(feof(file)) rcargv[rcargc]=strdup(line);
 /* XXX			process_args(rcargc+1, rcargv); */
 						process_args(rcargc, rcargv);
-						for(rcargc--;rcargc-1;rcargc--) free(rcargv[rcargc]);
+    					        for(rcargc--;rcargc>=0;rcargc--) free(rcargv[rcargc]);
 					}
 				}	
 				fscanf(file, " %s ", line);

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to