annolinux / gnome-mplayer

Automatically exported from code.google.com/p/gnome-mplayer
0 stars 0 forks source link

found a possible memory leak in file nautilus_property_page.c #204

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. gnome-mplayer-0.9.6$ cppcheck -a -q -v -f -j3 .
2. output: [./src/nautilus_property_page.c:140]: (error) Memory leak: ret

This possible leak was detected by using the static code analyis tool
cppcheck. It prints a waring about a possible memory leak at file
src/nautilus_property_page.c at line 140. Take a look at the code.

    if (error != NULL) {
        printf("Error when running: %s\n", error->message);
        g_error_free(error);
        error = NULL;
        if (out != NULL)
            g_free(out);
        if (err != NULL)
            g_free(err);
140     return NULL;
    }

Here the function return without freeing the memory of variable ret. It is
allocated at line 108.

A possible solution might be:

    if (error != NULL) {
        printf("Error when running: %s\n", error->message);
        g_error_free(error);
        error = NULL;
        if (out != NULL)
            g_free(out);
        if (err != NULL)
            g_free(err);
        if(ret != NULL)
            g_free(ret);
142     return NULL;
    }

Best regards

Ettl Martin

What version of the product are you using?
 gnome-mplayer-0.9.6

On what operating system?
Ubuntu-Linux, Jaunty 9.04, 32-Bit

Please provide any additional information below.

Original issue reported on code.google.com by ettl.mar...@gmail.com on 16 Jun 2009 at 7:16

GoogleCodeExporter commented 8 years ago
Fixed

Original comment by kdeko...@gmail.com on 16 Jun 2009 at 12:47