OSDN Git Service

Fix memory leaks
authorTakashi Iwai <tiwai@suse.de>
Thu, 9 Feb 2006 11:37:04 +0000 (11:37 +0000)
committerTakashi Iwai <tiwai@suse.de>
Thu, 9 Feb 2006 11:37:04 +0000 (11:37 +0000)
Fixed small memory leaks in the parser.

src/control/setup.c

index 5af2037..c0848c3 100644 (file)
@@ -461,9 +461,11 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
                        err = snd_config_get_bool_ascii(tmp);
                        if (err < 0) {
                                SNDERR("field %s is not a boolean", id);
+                               free(tmp);
                                goto _err;
                        }
                        lock = err;
+                       free(tmp);
                        continue;
                }
                if (strcmp(id, "preserve") == 0) {
@@ -474,9 +476,11 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
                        err = snd_config_get_bool_ascii(tmp);
                        if (err < 0) {
                                SNDERR("field %s is not a boolean", id);
+                               free(tmp);
                                goto _err;
                        }
                        preserve = err;
+                       free(tmp);
                        continue;
                }
                if (strcmp(id, "value") == 0) {
@@ -495,9 +499,11 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
                        err = snd_config_get_bool_ascii(tmp);
                        if (err < 0) {
                                SNDERR("field %s is not a boolean", id);
+                               free(tmp);
                                goto _err;
                        }
                        optional = err;
+                       free(tmp);
                        continue;
                }
                SNDERR("Unknown field %s", id);