Browse code

fix memory leaks

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@799 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/08/26 10:01:27
Showing 4 changed files
... ...
@@ -1,3 +1,8 @@
1
+Thu Aug 26 02:53:41 CEST 2004 (tk)
2
+----------------------------------
3
+  * clamscan, clamd, zziplib: Fix possible small memory leaks (thanks to
4
+			      Christophe GRENIER <grenier*cgsecurity.org>)
5
+
1 6
 Thu Aug 26 02:23:36 CEST 2004 (tk)
2 7
 ----------------------------------
3 8
   * freshclam/dns.c: Fix compilation error on Cygwin (thanks to Nigel)
... ...
@@ -330,6 +330,7 @@ int dazukoRegister_TS(dazuko_id_t **dazuko_id, const char *groupName, const char
330 330
 		free(request->buffer);
331 331
 		free(request->reply_buffer);
332 332
 		free(request);
333
+		free(temp_id);
333 334
 
334 335
 		return -1;
335 336
 	}
... ...
@@ -195,6 +195,7 @@ int scanmanager(const struct optstruct *opt)
195 195
 		    /* we need to complete the path */
196 196
 		    if(!getcwd(cwd, sizeof(cwd))) {
197 197
 			mprintf("@Can't get absolute pathname of current working directory.\n");
198
+			free(limits);
198 199
 			return 57;
199 200
 		    } else {
200 201
 			fullpath = mcalloc(512, sizeof(char));
... ...
@@ -382,10 +382,14 @@ __zzip_parse_root_directory(int fd,
382 382
 	{ d = (void*)(fd_map+fd_gap+offset); } /* fd_map+fd_gap==u_rootseek */
383 383
         else
384 384
         {
385
-            if (io->seeks(fd, u_rootseek+offset, SEEK_SET) < 0)
385
+            if (io->seeks(fd, u_rootseek+offset, SEEK_SET) < 0) {
386
+		free(hdr0);
386 387
                 return ZZIP_DIR_SEEK;
387
-            if (io->read(fd, &dirent, sizeof(dirent)) < __sizeof(dirent))
388
+	    }
389
+            if (io->read(fd, &dirent, sizeof(dirent)) < __sizeof(dirent)) {
390
+		free(hdr0);
388 391
                 return ZZIP_DIR_READ;
392
+	    }
389 393
             d = &dirent;
390 394
         }
391 395