Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
vala
vala
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 702
    • Issues 702
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 39
    • Merge Requests 39
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • GNOME
  • valavala
  • Issues
  • #550

Closed
Open
Opened Jul 27, 2016 by bugzilla-migration@bugzilla-migrationReporter

Memory leak in InputVector.buffer

Submitted by Marcin Lewandowski

Link to original bug (#769224)

Description

Please consider the following piece of code:

class Test {
  private void on_read(Socket socket) {
    InputVector[] input_vectors = {
      InputVector() {
        buffer = new uint8[64],
        size = 64
      },
    };
  }

  public static void main(string[] argv) {

  }
}

valac 0.32.1 will produce the following piece of code

static void test_on_read (Test* self, GSocket* socket) {
	GInputVector* input_vectors = NULL;
	guint8* _tmp0_ = NULL;
	GInputVector _tmp1_ = {0};
	GInputVector* _tmp2_ = NULL;
	gint input_vectors_length1 = 0;
	gint _input_vectors_size_ = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (socket != NULL);
	_tmp0_ = g_new0 (guint8, 64);
	memset (&_tmp1_, 0, sizeof (GInputVector));
	_tmp1_.buffer = _tmp0_;
	_tmp1_.size = (gsize) 64;
	_tmp2_ = g_new0 (GInputVector, 1);
	_tmp2_[0] = _tmp1_;
	input_vectors = _tmp2_;
	input_vectors_length1 = 1;
	_input_vectors_size_ = input_vectors_length1;
	input_vectors = (g_free (input_vectors), NULL);
}

tmp0 is never deallocated

probably the same apply to OutputVector

Version: 0.32.x

Edited Feb 21, 2019 by Corentin Noël
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/vala#550