From: Andre Noll Date: Thu, 17 Jan 2008 20:50:20 +0000 (+0100) Subject: vcc.c: Fix a memory leak in recv_afs_result(). X-Git-Tag: v0.3.1~88 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=e13271a35ebe1580929c3a5de3169501b5d81634;ds=sidebyside vcc.c: Fix a memory leak in recv_afs_result(). This function contained a code path that allocated the buffer for the chunk table and then returned an error (due to a failing fstat()) without freeing the chunk table buffer. --- diff --git a/vss.c b/vss.c index 89e06c92..8ba17fc3 100644 --- a/vss.c +++ b/vss.c @@ -383,6 +383,7 @@ static void recv_afs_result(void) struct stat statbuf; struct timeval now; + mmd->afd.afhi.chunk_table = NULL; ret = recv_afs_msg(&passed_fd, &afs_code, &afs_data); if (ret < 0) goto err; @@ -419,6 +420,7 @@ static void recv_afs_result(void) tv_add(&now, &announce_tv, &data_send_barrier); return; err: + free(mmd->afd.afhi.chunk_table); if (passed_fd >= 0) close(passed_fd); PARA_ERROR_LOG("%s\n", para_strerror(-ret));