]> granicus.if.org Git - libass/commitdiff
Fix minor memory leak in ass_read_styles
authorGrigori Goronzy <greg@chown.ath.cx>
Sun, 7 Jun 2015 19:30:41 +0000 (21:30 +0200)
committerGrigori Goronzy <greg@chown.ath.cx>
Sun, 7 Jun 2015 19:31:19 +0000 (21:31 +0200)
Reported by clang scan-build static analysis. Also fix incorrect
return value in case of error.

libass/ass.c

index c9855ea4a75441de42291e8b2ed4aaf11cdd5042..6e9f2fef04d902baeaf2d761cc9182f6ca22aac3 100644 (file)
@@ -1229,12 +1229,13 @@ int ass_read_styles(ASS_Track *track, char *fname, char *codepage)
         buf = tmpbuf;
     }
     if (!buf)
-        return 0;
+        return 1;
 #endif
 
     old_state = track->parser_priv->state;
     track->parser_priv->state = PST_STYLES;
     process_text(track, buf);
+    free(buf);
     track->parser_priv->state = old_state;
 
     return 0;