Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mozilla 506875: fish_sound_comments_decode leaks

  • Loading branch information...
commit 20b5cdf6fe38f61a9847e46e82da60d7ac4b7877 1 parent 925d224
@kfish authored
Showing with 15 additions and 5 deletions.
  1. +15 −5 src/libfishsound/comments.c
View
20 src/libfishsound/comments.c
@@ -444,8 +444,10 @@ fish_sound_comments_decode (FishSound * fsound, unsigned char * comments,
if (len > 0) {
if ((nvalue = fs_strdup_len (c, len)) == NULL)
return FISH_SOUND_ERR_OUT_OF_MEMORY;
- if (fish_sound_comment_set_vendor (fsound, nvalue) == FISH_SOUND_ERR_OUT_OF_MEMORY)
+ if (fish_sound_comment_set_vendor (fsound, nvalue) == FISH_SOUND_ERR_OUT_OF_MEMORY) {
+ fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
+ }
fs_free (nvalue);
}
@@ -484,11 +486,15 @@ fish_sound_comments_decode (FishSound * fsound, unsigned char * comments,
debug_printf (1, "%s -> %s (length %d)", name, nvalue, n);
- if ((comment = fs_comment_new (name, nvalue)) == NULL)
+ if ((comment = fs_comment_new (name, nvalue)) == NULL) {
+ fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
+ }
- if (_fs_comment_add (fsound, comment) == NULL)
+ if (_fs_comment_add (fsound, comment) == NULL) {
+ fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
+ }
fs_free (nvalue);
} else {
@@ -497,11 +503,15 @@ fish_sound_comments_decode (FishSound * fsound, unsigned char * comments,
if ((nvalue = fs_strdup_len (name, len)) == NULL)
return FISH_SOUND_ERR_OUT_OF_MEMORY;
- if ((comment = fs_comment_new (nvalue, NULL)) == NULL)
+ if ((comment = fs_comment_new (nvalue, NULL)) == NULL) {
+ fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
+ }
- if (_fs_comment_add (fsound, comment) == NULL)
+ if (_fs_comment_add (fsound, comment) == NULL) {
+ fs_free (nvalue);
return FISH_SOUND_ERR_OUT_OF_MEMORY;
+ }
fs_free (nvalue);
}
Please sign in to comment.
Something went wrong with that request. Please try again.