From 485c81f8613e0aa0e7b8d5a5d63ac6264e4a7786 Mon Sep 17 00:00:00 2001 From: biocrasher Date: Mon, 17 Jul 2006 11:55:10 +0000 Subject: segfault on big filenames fixed git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@21 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/parseargs.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/recordmydesktop/src/parseargs.c b/recordmydesktop/src/parseargs.c index 500b778..8125972 100644 --- a/recordmydesktop/src/parseargs.c +++ b/recordmydesktop/src/parseargs.c @@ -79,7 +79,8 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ if(argc==2){ if(argv[1][0]!='-'){ - realloc(arg_return->filename,strlen(argv[1])+1); + free(arg_return->filename); + arg_return->filename=malloc(strlen(argv[1])+1); strcpy(arg_return->filename,argv[1]); return 0; } @@ -131,7 +132,8 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ } else if(!strcmp(argv[i],"-display")){ if(i+1display,strlen(argv[i+1])+1); + free(arg_return->display); + arg_return->display=malloc(strlen(argv[i+1])+1); strcpy(arg_return->display,argv[i+1]); } else{ @@ -206,7 +208,8 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ } else if(!strcmp(argv[i],"-o")){ if(i+1filename,strlen(argv[i+1])+1); + free(arg_return->filename); + arg_return->filename=malloc(strlen(argv[i+1])+1); strcpy(arg_return->filename,argv[i+1]); } else{ @@ -366,7 +369,8 @@ int ParseArgs(int argc,char **argv,ProgArgs *arg_return){ } else if(!strcmp(argv[i],"-device")){ if(i+1device,strlen(argv[i+1])+1); + free(arg_return->device); + arg_return->device=malloc(strlen(argv[i+1])+1); strcpy(arg_return->device,argv[i+1]); } else{ -- cgit v1.2.3