LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2015, 05:52 AM   #1
geoprogrammer
LQ Newbie
 
Registered: Nov 2015
Location: Athens, Greece
Posts: 14

Rep: Reputation: Disabled
Problem: glibc detected, realloc(): invalid next size: 0x0000000002604320


Hi again.
I am an amateur when it comes to programming, so I require some more help

I get his message, while trying to create some models. It is part of the MTPACKAGE, Green's Functions. While trying to run_fkrsort, I get the message:

Code:
*** glibc detected *** /root/MTPACKAGE/MTCODE/BIN/window: realloc(): invalid next size: 0x0000000002604320 ***
I checked the window.c file, and the code is this:

Code:
/*
program to window portion of 3-D data file

window len= [in= out= planes= vecs= esize= p0= v0= e0= np= nv= ne= dp= dv= de=]

arguments:
	in=stdin	input file, a series of vectors
	out=stdout	windowed result
	len=(nt=)	length of input file vector
	vecs=(nx=)	number of vectors in a plane
	planes=1	number of planes in dataset
	esize=4		size of input file element in bytes
	p0=0		the first plane to be copied
	v0=0		the first vector in each plane to be copied
	e0=0		the first element of each vector to be copied
	np=(planes-p0)/dp	the number of planes to be copied
	nv=(vecs-v0)/dv	the number of vectors to be copied
	ne=(len-e0)/de	the number of elements from each vector to be copied
	dp=1		increment between input planes
	dv=1		increment between input vectors
	de=1		increment between input elements
#
to compile: cc window -o window -lget
*/
#include <stdio.h>
#include <fcntl.h>

char in[40], out[40];
main (argc,argv)
int argc; char **argv;
	{
	int rfile,wfile;
	int len,esize=4;
	int v0=0,e0=0,nv=0,ne=0,dv=1,de=1;
	int nseek,de1,i,j,k,planes=1,vecs=0,np=0,dp=1,nseek1,m,p0=0;
	char *x;

	/* fetch parameters */
	setpar(argc,argv);
	if (getpar("in","s",in)) {
		if ((rfile = open(in,O_RDONLY,0644)) < 2) {
			fprintf(stderr,"cannot open %s\n",in);
			exit(-1);
		}
	}
	else rfile=0;
	if (getpar("out","s",out)) {
		if ((wfile = open(out,O_WRONLY | O_CREAT | O_TRUNC,0644)) < 2) {
			fprintf(stderr,"cannot open %s\n",out);
			exit(-1);
		}
	}
	else wfile=1;
	if (getpar("len","d",&len)==0)
		if (getpar("nt","d",&len)==0) fprintf(stderr,"len= missing\n");
	getpar("planes","d",&planes);
	getpar("esize","d",&esize);
	if (getpar("vecs","d",&vecs)==0) mstpar("nx","d",&vecs);
	getpar("p0","d",&p0);
	getpar("v0","d",&v0);
	getpar("e0","d",&e0);
	getpar("dp","d",&dp);
	getpar("dv","d",&dv);
	getpar("de","d",&de);
	if (getpar("np","d",&np)==0) np = (planes - p0) / dp;
	if (getpar("nv","d",&nv)==0) nv = (vecs - v0) / dv;
	if (getpar("ne","d",&ne)==0) ne = (len - e0) / de;
	endpar();
	fprintf(stderr,"  in=%s out=%s\n",in,out);
	fprintf(stderr,"  planes=%d vecs=%d len=%d esize=%d\n",planes,vecs,len,esize);
	fprintf(stderr,"  np=%d p0=%d dp=%d\n",np,p0,dp);
	fprintf(stderr,"  nv=%d v0=%d dv=%d\n",nv,v0,dv);
	fprintf(stderr,"  ne=%d e0=%d de=%d\n",ne,e0,de);
	
	x = (char *) malloc(ne*de*esize);
	lseek (rfile,((p0*vecs+v0)*len+e0)*esize,0);
	nseek = ((dv - 1) * len + (len - ne * de)) * esize;
	nseek1 = ((dp - 1) * vecs + (vecs - nv * dv)) * len * esize;
	ne *= esize;
	de1 = (de - 1) * esize;
	while (np-->0) {
		for (m=0; m<nv; m++) {
			read (rfile,x,ne*de);
			if (de>1) for (i=j=0; i<ne; j+=de1)
				for (k=i+esize; i<k;) x[i++] = x[j++];
			dowrite (wfile,x,ne);
			lseek (rfile,nseek,1);
		}
		lseek (rfile,nseek1,1);
	}
}

int
dowrite(fd,buf,bytes)
int fd, bytes;
char *buf;
{
	int nwrite, total;

	if ((total = write(fd,buf,bytes)) <= 0) return(total);
	buf += total;
	while (bytes > total) {
		if ((nwrite = write(fd,buf,bytes-total)) <= 0) return(total);
		total += nwrite;
		buf += nwrite;
	}
	return(total);
}
Please tell me if you need anything else.
I tried googling before posting, but -as I mentioned-, I'm a complete amateur and I'm still learning the ropes, so the answers I found made no sense to me...

Thank you in advance for any help provided!
Steve
 
Old 12-01-2015, 01:41 PM   #2
geoprogrammer
LQ Newbie
 
Registered: Nov 2015
Location: Athens, Greece
Posts: 14

Original Poster
Rep: Reputation: Disabled
Bump!
Anyone?
 
Old 12-14-2015, 03:10 AM   #3
geoprogrammer
LQ Newbie
 
Registered: Nov 2015
Location: Athens, Greece
Posts: 14

Original Poster
Rep: Reputation: Disabled
Bump!
Anything?
Someone, anyone, please, respond :P
 
  


Reply

Tags
mtpackage


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] problem with realloc(): invalid next size golden_boy615 Programming 2 07-19-2011 05:24 AM
Won't get realloc to work - glibc: invalid old size ruh31 Programming 5 06-08-2011 05:39 PM
*** glibc detected *** free(): invalid next size hs_linux Programming 1 02-27-2010 01:08 AM
Error during cimserver start : *** glibc detected *** realloc(): invalid pointer MaverickLikesMustang Linux - Software 0 02-14-2008 06:42 AM
*** glibc detected *** ./input: realloc(): invalid next size: custode Programming 4 05-04-2007 03:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration