Re: zip error: out of memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2004-07-28 at 11:35, Luca Ferrari wrote:
> Hi,
> I was doing a backup of a NFS partition (about 300 MB) using zip but I got the 
> error:
> Zip error: Out of memory (allocating temp filename)

All assuming you are running recent stuff...

Either this code is failing:

 tempzip = malloc(4);
    if (tempzip == NULL) {
      ZIPERR(ZE_MEM, "allocating temp filename");
    }

or this code (both from info-zip's zip.c source).

if ((tempzip = tempname(zipfile)) == NULL) {
      ZIPERR(ZE_MEM, "allocating temp filename");
    }

On Linux (if I'm preprocessing the MANY #if(n)defs in info-zip's
fileio.c properly) tempname() runs mktemp() after malloc'ing up a 12
byte buffer. Either malloc is failing, or mktemp() is returning a null
pointer.

But here's the calling code:

...
if ((t = malloc(12)) == NULL)
      return NULL;
    *t = 0;
...
 strcat(t, "ziXXXXXX"); /* must use lowercase for Linux dos file system
*/
  return mktemp(t);



And here's the glibc mktemp() code:

mktemp (template)
     char *template;
{
  if (__gen_tempname (template, __GT_NOCREATE) < 0)
    /* We return the null string if we can't find a unique file name. 
*/
    template[0] = '\0';
                                                                                
  return template;
}



So I can't see how tempname() returns a NULL pointer under any
circumstance other than malloc failing. Which could be a side-effect of
the heap getting buggered by other code, or maybe you really are out of
mem. Looks like zip allocates mem for every file it finds and only frees
it after it's done, so it's not the size of the backup set so much as it
is the number of files that impact memory use.

If you can build the source I'd put some printf() calls in zip.c and
especially filio.c and run again.


CD

-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux